MYsql Parse Error

telsave

DW Member +
Joined
Jun 8, 2002
Messages
658
Reaction score
33
Location
Newcastle
Hi

I am going first to ask for patience as well as help I am trying to learn mySQL and phpmyadmin. I have written some code but have got the following error and I cannot see the problem wonder if someone would kindly help please.


Error message received: Parse error: syntax error, unexpected T_VARIABLE in /home/telsave/public_html/freudzstock/index.php on line 12
Possibly my old eyes have missed something.

Code as written

11.//Build Main Navigation menu and gather page data here
12.$sqlCommand = "SELECT id, linklabel FROM pages ORDER BY pageorder ASC",
13.$query=mysqli_query($myConnection, $sqlCommand) or die(mysqli_error());
14.
15.$menuDisplay="";
16.while($row=mysqli_fetch_array($query)){
17. $pid=$row["id"];
18. $linklabel=$row["linklabel"];
19.
20. $menuDisplay='a href=index.php?pid=' . $pid .'">' .$linklabel . '</a><br />';
21.
22.}
23.mysqli_free_result($query);
24.//mysqli_close($myConnection),

If anyone knows of any good training online courses can you let me know please

cheers
 
It's very difficult due to differing environments but I'm looking suspiciously at the end of line 12 where I would not have expected a comma and would have expected a semi-colon before the final "
 
I've had to make some assumptions but, looks like he's preloading the variable $sqlcommand so the ; would go before the " like:

% export SQLCOMMAND="SELECT 'aaa' FROM \"generate_series\"(1,2);"
% echo $SQLCOMMAND
 
A big thank you from both of you for taking time out to try to help. The eror is still there so it looks like something basic I have done earlier, as It is a test bestn thing to do is go back to beginning and build again - bets way to learn no doubt.

I sometime wish there was apill available to take and have all the knowdleged passed into this old head of mine.

I use dreeamweaver for building web pages and of course the codes are being written over and over hence the desire to learn MYsql and PHPmyadmin, trouble is at myu age I have not got that long left to learn things

:BLOBBY:

Thanks to you both again.
 
is that the code from index.php or is that what is referencing index.php?
 
Well I have got a headache but I will get there. I have now got the Dummies book so will work through that as it is aptly named.:Drool:
 
Hi M8's

If anyone is still out there waiting for my next query :) !


I find it quite difficult to learn from a book no matter how well written, I am trying to follow 'Sitepoint build your own database driven website.'

I believe I have set my basics correctly, I am using wamp to access mysql and php plus apache.

I am at the stage of entering some basic commands to check things through such as

QUERY: mysqladmin --vesion
RESULT: mysqliadmin Ver 8.42 Distribution: 5.5.16 for win32 x86

QUERY: mysqladmin -u root status
RESULT: Uptime: 88456 Threads: 1 Questions: 1 Slow queries: 33 Flush Tables: 1 Open tables: 0 queries per second avg: 0.000

QUERY: mysqladmin -u root -p status
RESULT: enter password (entered)
mysqladmin connect to server at 'localhost' failed
error 'Access denied for user 'root'@'localhost' <using password YES>'

Can anyone please explain in simple terms what I may have done incorrectly, it is difficult to ask a book questions!
I should say I have written the simple code in one of the examples to display date on search and it displayed correctly folowing help from 'Him Her' & 'Exos'.

thanks
 
Either user 'root' does not have access to mysql or the password you used was incorrect - if it's not your server you won't have root access, you should use your own logon and password:

mysqladmin -u your-logon-name -p status
 
Back
Top