Page 1 of 1

eeror in my php/mysql...

PostPosted: 04. March 2010 10:49
by julyhad
Pls, whenever i used "$sql = "INSERT INTO $tbluser () VALUES ()" statement. I do encounter this error "Parse error: syntax error, unexpected T_VARIABLE". can someone tell me what to do?

Re: eeror in my php/mysql...

PostPosted: 04. March 2010 12:36
by Altrea
Look your codelines around.
Missing semicolon/Brackets?

Re: eeror in my php/mysql...

PostPosted: 24. March 2010 17:35
by julyhad
Altrea wrote:Look your codelines around.
Missing semicolon/Brackets?

Pls, Altreal there is nothing like missing semicolon/brackets. but am still facing the problem. What can i do?
thanx,
Julyhad.

Re: eeror in my php/mysql...

PostPosted: 24. March 2010 18:07
by Altrea
What error message do you get now?
It's easier to help you if you show us your code.

Re: eeror in my php/mysql...

PostPosted: 24. March 2010 18:36
by JustMe
JulyHad,

If you don't post the actual code that causes the problem, then we can only guess.

eg. What is wrong with this statement: x = a + b ;
It is fine unless I include the previous line which reads a="Hi Mom". Now it's easy to see the problem.

I use insert statements like yours all the time. So without the details, none of us can help you.

If you don't want us to know or you think the code is too complicated to post, that's fine. create a very simple exmple that demonstrates your problem using hard coded values that do not give away anything you hold near and dear.

Justme

Re: eeror in my php/mysql...

PostPosted: 16. July 2010 19:03
by julyhad
Thanks, everybody in the house your suggestion has worked for me.

Re: eeror in my php/mysql...

PostPosted: 16. July 2010 19:53
by julyhad
$sql = "SELECT * FROM $tbl ";
$res = @mysql_query($sql);
$rows = @mysql_num_rows($res);
if($rows > 0){
while($row = @mysql_fetch_array($res)){
$f_date = kill_null($row['A_Date'], "");
$f_type = kill_null($row['Type'], "");
}
}
@mysql_free_result($res);

My purpose is to display the whole rows and columns in the table but the whole columns are displaying with only one row which is the first row. Pls, what can i do to display the whole rows?

Re: eeror in my php/mysql...

PostPosted: 16. July 2010 20:16
by Altrea
julyhad wrote:$sql = "SELECT * FROM $tbl ";
$res = @mysql_query($sql);
$rows = @mysql_num_rows($res);
if($rows > 0){
while($row = @mysql_fetch_array($res)){
$f_date = kill_null($row['A_Date'], "");
$f_type = kill_null($row['Type'], "");
}
}
@mysql_free_result($res);

My purpose is to display the whole rows and columns in the table but the whole columns are displaying with only one row which is the first row. Pls, what can i do to display the whole rows?


You can only get one line because your Variables get overwritten on every round in the while loop.
Either output your rows directly in the while-loop, or create an array.
I really don't know what you are trying there ^^