Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

Problems with my variable

Codes here !

Moderators: macek, egami, gesf

Problems with my variable

Postby faiyth » Thu Feb 27, 2003 1:18 pm

On one page I have this...

<a href="go.php?q_name=BMW">

It sends me to a page that has this sql statement.

$sql1 = "SELECT * FROM cars WHERE car_name = '{$q_name}'";

This returns NOTHING... so I changed the sql statement to:

$sql1 = "SELECT * FROM cars WHERE car_name = 'BMW'";

Now that works.. what am I doing wrong??
faiyth
New php-forum User
New php-forum User
 
Posts: 3
Joined: Thu Feb 27, 2003 1:17 pm

Postby faiyth » Thu Feb 27, 2003 1:56 pm

Nevermind I figured it out.. it had to be a capital letter for some reason. :) q_name had to become q_Name before it would work. THANKS ANYWAYZ!
faiyth
New php-forum User
New php-forum User
 
Posts: 3
Joined: Thu Feb 27, 2003 1:17 pm

Postby Romantik » Fri Feb 28, 2003 12:04 am

$sql1 = "SELECT * FROM cars WHERE car_name = '$_GET["q_name"]."'";

http://www.php.net/manual/en/security.r ... lobals.php
Romantik
New php-forum User
New php-forum User
 
Posts: 67
Joined: Mon Feb 24, 2003 2:55 am
Location: ../Ukraine/Kherson


Return to mySQL & php coding

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.