Jump to content

anfo

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Everything posted by anfo

  1. is it possible to put data from a sql query into text boxes for doing an update query? what i'm doing is trying to change an address on the same page as I display results from a query to get the person's details. e.g. retrieve joe blogs address 12 smith st, have these display in text fields then change it to 21 jump st then click on a submit button which runs an UPDATE SET query. any help gratefully recieved
  2. is it possible to have multiple 'submit' buttons on one page and to be handled on one page? could it be done with a switch statement? any help gratefully recieved
  3. I noticed that in the first script there are $_REQUEST superglobals and in the second you are using $_POST. this could be the problem. the other thing is in the second script there's no session start() and as far as I can see no way of accessing the information in those session variables setup in the first script. Hope this helps Anfo
  4. check the size of allowed uploads in the php.ini configuration file this might be set too low for your upload.
  5. at the end of the sql query use the keyword LIMIT and the number of results you want for example; SELECT ghosts FROM stories LIMIT 30 sorry can't help you with the rest only fairly new to php/mysql myself
  6. anfo

    Question

    and on the page you redirect it to try this.... if(isset($_POST['submitted'])) { //do something echo '<p> data received</p>'; { else { echo '<p>Page not submitted</p>'; this bit of code tests whether the information has been sent to the new page or else it shows a message Page not submitted. the //do something is a comment but where you see the data received line this is where you do something with the information.
  7. I thought they were? It's my understanding that the part after the equals sign is the value but maybe i'm mistaken. mfirstname = " . mysql_real_escape_string(stripslashes($_POST["mfirstname"])) . "
  8. Hi Guys, I am having a problem with my sql code. I get an error message "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Smith St , suburb = Sydney , pcode = 2000 , ' at line 3. I have tried the code below with the keyword AND in placde of the comma's, as well as AND before mfirstname, they both produce the same error. Yes I am trying to integrate this code with php. php version : 5.2.6 sql version: 5.0.51b on windows xp. I am not sure if I am trying to update too many columns at a time or what. any help would be appreciated. Thanks and Regards Anfo here is my sql code. $query = "UPDATE members SET msurname = " . mysql_real_escape_string(stripslashes($_POST['msurname'])) . " , mfirstname = " . mysql_real_escape_string(stripslashes($_POST['mfirstname'])) . " , address = " . mysql_real_escape_string(stripslashes($_POST['address'])) . " , suburb = " . mysql_real_escape_string(stripslashes($_POST['suburb'])) . " , pcode = " . mysql_real_escape_string(stripslashes($_POST['pcode'])) . " , home = " . mysql_real_escape_string(stripslashes($_POST['home'])) . " , work = " . mysql_real_escape_string(stripslashes($_POST['work'])) . " , mobile = " . mysql_real_escape_string(stripslashes($_POST['mobile'])) . " , email = " . mysql_real_escape_string(stripslashes($_POST['email'])) . " WHERE member_id = $row[0] LIMIT 1";
  9. here's a snippet of code, that I just can't get to work and still being a fledgling programmer can't figure out why not..... I am using PHP version 5.2.6, mysql version is 5.0.51b, on a win xp pro platform. If antone can help I'd be extremely grateful. Thanks Anfo. <form action="title_search.php" method="get"> <fieldset> <p><strong>Title: </strong><input type="text" name="title" maxlength="60"/></p> <input type="button" name="submit" value="Search" /> <input type="hidden" name="submitted" value="TRUE" /> </fieldset> </form> <?php // Connect to the db. require_once ('./includes/dbconn.php'); // Make the query. $query = "SELECT title FROM `books` WHERE `title` LIKE $_GET['title']"; // Run the query. $result = @mysql_query ($query); // If query runs alright, display the records. if ($result) { // Table header. echo '<table align="center" cellspacing="0" cellpadding="5"> <tr><td align="left"><b>Title</b></td></tr>'; // Fetch and print all the records. while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo '<tr><td align="left">' . $row['title'] . '</td></tr>'; } echo '</table>'; ?> (edited to add tags)
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.