mysql statments in php
Posted: Mon Jun 18, 2007 4:46 pm
feyd | Please use
this is the function that loads on usersEdit.php
any help what so ever would be great!
-Shan
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
ok so i'm building this content management system. And i have a function to add new users and update the users information. Adding new users works fine, and when i test the script on my server (invisibled.com) updating works, but when i test it on my local host updating doesn't work. When i say updating i mean the sql query doesn't update the database. so basicly, i was wondering if anybody could shed some light as to why its not working on my localhost.
my localhost is running php 5 and so is my server (invisibled.com) and the functions get loaded from a class file. i'll paste in the functions i have for updating.
this code is in users.php and runs after you hit submit on the form in usersEdit.php (its all pretty straight forward)Code: Select all
//UPDATE USERS FUNCTION
if (isset ($_POST["updateID"])){
$updateID = $_POST["updateID"];
$realName = $_POST["realName"];
$realName = str_replace( "'", "'", $realName );
$queryUpd = " UPDATE ida_users SET realName='$realName' WHERE entryID='$updateID';";
$rsUpd = mysql_query($queryUpd) or die("<h1>Query Failed</h1> <b> $queryUpd</b>");
}
//UPDATE USERS FUNCTIONthis is the function that loads on usersEdit.php
Code: Select all
function usersEdit($go){
$updateID = $_GET["updateID"];
$qSel = "SELECT * FROM ida_users WHERE entryID='$updateID';";
$rsSel = mysql_query($qSel) or die("$qSel failed");
if($res = mysql_fetch_array($rsSel)) {
$realName =$res["realName"];
}
?>
<table>
<form action="users.php" method="POST">
<td><input type="hidden" name="updateID" value="<?=$updateID?>" /></td></tr>
<tr><td><input type="text" name="realName" value="<?php echo $realName?>" /></td></tr>
<tr><td width="10" align="right"><input type="submit" name="update" value="Save" /></td><td> </td></tr>
</form>
</table>
<?php
}//END usersEdit($go)any help what so ever would be great!
-Shan
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]