Displaying linked records of a category

IRHM73
03:05:12
Hi I wonder whether someone could help me please.

I have been trying to put together the script for the example 'Displaying linked records of a category'.

I have downloaded the 'sql dump files' to my database, copied both scripts shown and saved them as 'php' files as instructed. The 'z_dp.php' file that is also required is as follows:

<?php mysql_connect("host", "username", "password")
or die(mysql_error()); mysql_select_db("database");
?>


However, when I try and run this I receive the following error:
[quote]Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /homepages/2/d333603417/htdocs/development/ajax.php on line 91[/quote]
with line 91 being this:
echo "</head><body onload="ajaxFunction()";>";
.

I just wondered if someone could perhaps pleae help to resolve this issue.

Many thanks and kind regards
smo1234
03-06-2012
In the line below there are double quotes which are to be escaped otherwise that is treated as end of the echo command. You can read more on PHP escape command here.

echo "</head><body onload="ajaxFunction()";>";

change this line to
echo "</head><body onload=\"ajaxFunction()\";>";
IRHM73
03-06-2012
Hi, many thanks for taking the time to reply to my post. I've made the changes uou suggested, but unfortunately I'm still getting the same error. Kind regards.
smo1234
03-06-2012
The same problem was there in two more places, now it is rectified, Take fresh code from here
http://www.plus2net.com/php_tutorial/ajax-listbox.php
IRHM73
03-06-2012
Hi, many thanks for this. I've replaced my code with the script provided in the link you sent. The page now correctly loads, but unfortunately it is stuck on 'Please wait'. I've tried various values from the drop down menu which unfortunately hasn't wqorkd. I've also logged onto my server and all seems to be well there so I donlt think it's a slow server issue.. Once again many thanks for your continued help with this. Kind regards
smo1234
03-06-2012
Now it is not getting the data from internal page, Check that page , it is connected to database or not. It is getting the value or not etc...
You can check that page by directly opening in browser with fixed cat_id value, ( 2nd line is commented with a fixed value of cat_id, you can enable that line and open the file directly. )
IRHM73
03-06-2012
Hi, I've checked the internal 'subcat2.php' file and I recieve the following error: Parse error: syntax error, unexpected T_STRING in /homepages/2/d333603417/htdocs/development/subcat2.php on line 22. This is with using the hard coded 'catid' as you suggested. Regards
smo1234
03-06-2012
While directly checking you need to suppress the error reporting. Change this lines like this
@$cat_id=$_GET['cat_id'];
$cat_id=1; // remove this line after testing

Go to another line below and suppress the error message here also
@$message .= mysql_error();

Now the page is updated with these changes. Try now.
thanks.
IRHM73
03-11-2012
Hi, many thanks for your continued help with this and apologies for not getting back to you sooner. I've tried the new code and unfortunately it is still stuck on the 'Please wait' message. Kind regards
smo1234
03-11-2012
You can directly open subcat2.php file and check for error output if any. You can even pass the cat_id value like this

subcat2.php?cat_id=1

let us know if you are getting any error message or not. If you can send me the link of your pages then I can check the error message, if you don't want to use here , then use the contact us page and send me the link
IRHM73
03-11-2012
Hi, I've just tried your suggested method of 'subcat2.php?cat_id=1' and by opening the file as normal and I receive the following error:

Parse error: syntax error, unexpected T_STRING in /homepages/2/d333603417/htdocs/development/subcat2.php on line 26

Hope this helps.

Kind regards



smo1234
03-11-2012
Sorry for that, now it is updated with correct code. Used the same code and checked. It is working fine. Take a fresh code of subcate2.php and try. It should work now
IRHM73
03-12-2012
Hi, this works a treat.

Many thanks for all your hard work, time and trouble.

Kind regards

Chris
Please Login to post your reply or start a new topic