Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
session prob - help with custom script for oscommerce
Old 03-13-2005, 08:32 AM session prob - help with custom script for oscommerce
cforscutt's Avatar
Novice Talker

Posts: 9
Trades: 0
I have a problem but I’m not sure if anyone is going to be able to help - just a long shot I guess! Basically I’m building a php mysql site built upon the open source oscommerce solution, as I have modified it to allow me to setup multiple shops from the one osc database. Anyway the main site acts as a portal, listing high streets and specifically the shops which have signed up for the e-commerce solution (powered by oscommerce). I have built in the functionality of the main site myself using a separate include directory which contains the following:

_____________________________________
dbconnect.php
<?

include("include/config.php");

$db = mysql_connect("$dbserver", "$dbuser", "$dbpass");
mysql_select_db("$dbname",$db);
?>
_____________________________________

config.php
<?
$dbname = "****";
$dbserver = "localhost";
$dbuser = "****";
$dbpass = "****";
$table = "****"
?>
_____________________________________

I have a search page which enables the user to pull back shops based on shop name or description, BUT if the user uses the back button once they view the results and click on a selection the results page doesn’t refresh instead the user is presented with a ‘The page cannot be displayed’ page, and it isn’t until the user refreshes the search.php page or hits back again that the page loads. I have found that if I put my require includes the other way round so my dbconnect takes 1st shout over the oscommerce application_top.php the problem is solved

<?php
require('include/dbconnect.php');
require('includes/application_top.php');
?>

BUT I now get this error message at the top of the page despite the fact everything is working/functioning fine now?!

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/beetle/public_html/vhighstreet/shops/include/dbconnect.php:1) in /home/beetle/public_html/vhighstreet/shops/includes/functions/sessions.php on line 67

I guess the best thing to do would be to use the oscommerce includes as apposed to my own and re-write my scripts (this is where I need help). You may be wondering why I am even using oscommerce for the portal site in the first place, the reason being I want to promote the create account feature on the main site, so if you have an account its then universal to any shop powered by our(oscommerce modded) solution! I also make use of the IF statement for user logged in which determines the navigation so they can access there account address book etc.

Hope this makes sense here is the code I’m using for my search – that’s causing the problem, any ideas what I need to change to get it to talk to the server and database via the oscommerce includes, configure file I’m assuming this will solve the problem.

The code I used for my search is as follows (I stripped out a lot of html for the post):

<?php
require('includes/application_top.php');
require('include/dbconnect.php');
?>
<html>
<head></head>
<body bgcolor="#cccccc">
<div align="center">
<?
if ($searchstring)
{
$sql="SELECT * FROM street WHERE $searchtype LIKE '%$searchstring%' ORDER BY shop_short_descr ASC";


$result = mysql_query($sql);
$resultsnumber = mysql_numrows($result);

echo "<TABLE width=100% cellpadding=2 cellspacing=1 border=0>";
echo "number of results: $resultsnumber";
echo "<br><br>";

$alternate = "2";
while ($myrow = mysql_fetch_array($result))
{
$shop_name = $myrow["shop_name"];
$id = $myrow["id"];
$shop_short_descr = $myrow["shop_short_descr"];
$shop_address = $myrow["shop_address"];
$shop_location = $myrow["shop_location"];
$shop_postcode = $myrow["shop_postcode"];

if ($alternate == "1") {
$color = "#ffffff";
$alternate = "2";
}
else {
$color = "#cadeff";
$alternate = "1";
}
echo "<tr onMouseOver=this.style.backgroundColor='#cadeff';w indow.status=''; onMouseOut=this.style.backgroundColor='#ffffff';wi ndow.status='view.php?id=$id'; onClick=window.location.href='view.php?id=$id'><td ><a href='view.php?id=$id'><b>$shop_name</b></a> - $shop_address, $shop_location, $shop_postcode<br>$shop_short_descr<hr color=003399></td><td width=50><a href='view.php?id=$id'>view details</a><hr color=003399></td></tr>";
}
echo "</TABLE>";
echo "<p><a href='$PHP_SELF'><img src=images/button_back.gif border=0 alt=Back></a></p>";

}


else
{
?>
<form method="POST" action="<? $PHP_SELF ?>">
<table border="0" cellspacing="2" width="380">
<tr>
<td><h1>Search for</h1>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td valign="top">
<input type="text" name="searchstring" size="35">
</td>
<td>
<input type="radio" name="searchtype" value="shop_name" checked>
Shop name<br>
<input type="radio" name="searchtype" value="shop_long_descr">
Description<br>
<input type="radio" name="searchtype" value="shop_postcode">
Post Code</td>
</tr>
<tr>
<td><input type="image" src="images/button_search.gif" value="Submit" alt="Submit">
</td>
<td>&nbsp;</td>
</tr>
</table>
</form><?
}
?>


I have tried just removing my 'include/dbconnect.php' link but then it give me this error:

Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/beetle/public_html/vhighstreet/shops/search.php on line 150

number of results:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/beetle/public_html/vhighstreet/shops/search.php on line 157

I would really appreciate any help getting this sorted I just need to know what to do to the script to get it connecting to the database via the oscommerce includes directory and configure file etc. I would again really appreciate any assistance with this my e-mail address is chris@forscutt.com (cc to) cforscutt@hotmail.com

Kind regards,

Chris
cforscutt is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to session prob - help with custom script for oscommerce
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.10554 seconds with 12 queries