Reply to Re: sql insert

Your name:

Reply:


Posted by Koncept on 11/29/06 19:21

In article <ekjrkp$hrs$1@ss408.t-com.hr>, Gaga <rg2006@hotmail.com>
wrote:

> I dont know what is going on ( cuz i get no error message ) but i can make
> insert into mysql db (empty rows).
>
> Im testing with if(isset($_GET['name','ID'])) and all data that i need is
> passed from login page to check page.
>
> This is the insert part:
> mysql_query("INSERT INTO $users (name,ID)
> VALUES ($Tname, $Tid )");
>
> ??
>
>

$_GET['name','ID'] is incorrect syntax. You probably mean...

if( isset($_GET['name']) && isset($_GET['ID'])){
// do something...
}

<?php
extract($_GET);
if(isset($name)&&isset($ID)){
if(get_magic_quotes_gpc())
list($name,$ID) = array(stripslashes($name),stripslashes($ID));
$name=mysql_real_escape_string($name);
if(!is_numeric($ID))$ID=mysql_real_escape_string($ID);
$template = "INSERT INTO `%s` (`name`, `ID`) VALUES ('%s','%s')";
mysql_query(sprintf($template,$users,$name,$ID));
} else {
// handle unset var errors here
}
?>

--
Koncept <<
"The snake that cannot shed its skin perishes. So do the spirits who are
prevented from changing their opinions; they cease to be a spirit." -Nietzsche

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация