register_globals=off complient!?!!

Codes here !

Moderators: macek, egami, gesf

php-punk
New php-forum User
New php-forum User
Posts: 60
Joined: Sun Feb 02, 2003 2:10 am
Location: Leeds, Uk
Contact:

register_globals=off complient!?!!

Postby php-punk » Fri Feb 21, 2003 4:46 am

php-punk if you are getting your information from a post form then your code is not register_globals=off compliant.


i am trying to get some variables passsed from a HTML from into PHP which then inputs to a DB.

so far it has not been working, so i posted on here and got told its not complient to 'registar_globals =off'

how would i make it complient

heres the code:

Code: Select all

<?php
//connect to the DB
$Connect=mysql_connect(localhost,***,***) or die ("sorry unable to connect(1)");
//select DB
$DB=mysql_select_db(***) or die ("sorry unable to select DB");
// insert in to adamgb table: Fields, ID NAME DATE MAIL SITE POST  , values in field order, ID - auto incremented NAME, date(auto) MAIL, SITE, POST


$query="INSERT INTO `adamgb` (`id`, `name`, `date`, `mail`, `site`, `post`) VALUES ('', '$name', '', '$mail', '$site', '$post'); ";

mysql_query($query) or die ("Sorry unable to connect(2)");

echo("Your Comments were Entered into the Straight To The Point GuestBook, thanx!!");

echo("<a><Href http://members.lycos.co.uk/stu3sk8r/adam/display.php>View GuestBook</a>")
?>

User avatar
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby Oleg Butuzov » Fri Feb 21, 2003 7:56 am

Code: Select all

$query="INSERT INTO `adamgb` (`id`, `name`, `date`, `mail`, `site`, `post`) VALUES ('', '$_POST[name]', '', '$_POST[mail]', '$POST_[site]', '$_POST[post]'); ";

php-punk
New php-forum User
New php-forum User
Posts: 60
Joined: Sun Feb 02, 2003 2:10 am
Location: Leeds, Uk
Contact:

Postby php-punk » Sat Feb 22, 2003 8:01 am

rite... done thx, but.. it still dont work!! 8O

im still getting a error when it goes to run a query!!!?!

any help appreciated!!

User avatar
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby Oleg Butuzov » Sun Feb 23, 2003 12:10 am

Code: Select all

<?php
$link=mysql_connect(localhost,***,***) or die ("sorry unable to connect(1) <br> mysql_error()");
$DB=mysql_select_db(***, $link) or die ("sorry unable to select DB <br> mysql_error()");



$query="INSERT INTO `adamgb` (`id`, `name`, `date`, `mail`, `site`, `post`) VALUES ('', '$_POST[name]', '', '$_POST[mail]', '$_POST[site]', '$_POST[post]'); ";

mysql_query($query) or die ("Sorry unable to connect(2)<br> mysql_error()");

echo("Your Comments were Entered into the Straight To The Point GuestBook, thanx!!");

echo("<a><Href http://members.lycos.co.uk/stu3sk8r/adam/display.php>View GuestBook</a>")
?>



can youtell us ehat error you get ?

php-punk
New php-forum User
New php-forum User
Posts: 60
Joined: Sun Feb 02, 2003 2:10 am
Location: Leeds, Uk
Contact:

Postby php-punk » Sun Feb 23, 2003 9:59 am

ahh, thx aboutt eh Mysql_error( whish is acctualy displayed:)

Code: Select all

mysql_query($query) or die ("Sorry unable to connect(2)".mysql_error());

i found that the semi-colon (8O), was the problem, and it is now fixed and i have a simple working guest book!!, but im sure i'll be bk in the next day, as im about to make a admin panel for it!!

THANX!!

User avatar
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby Oleg Butuzov » Sun Feb 23, 2003 11:51 pm

want to say thank you ?
say it here http://www.php-forum.com/p/viewtopic.php?t=953


Return to “mySQL & php coding”

Who is online

Users browsing this forum: No registered users and 1 guest