PHP - Stack Overflow Questions Tags Users Badges Unanswered Ask Question Page Not Showing Database Updated Info But Database Is
I have a standard form that displays users current data from a mysql database once logged in(code obtained from the internet). Users can then edit their data then submit it to page called editform.php that does the update. All works well except that the page does not display the updated info. Users have to first logout and login again to see the updated info. even refreshing the page does not show the new info. Please tell me where the problem is as i am new to php.
my form page test.php
<?PHP require_once("./include/membersite_config.php"); if(!$fgmembersite->CheckLogin()) { $fgmembersite->RedirectToURL("login.php"); exit; } ?> <form action="editform.php?id_user=<?= $fgmembersite->UserId() ?>" method="POST"> <input type="hidden" name="id_user" value="<?= $fgmembersite->UserId() ?>"><br> Name:<br> <input type="text" name="name" size="40" value="<?= $fgmembersite->UserFullName() ?>"><br><br> Email:<br> <input type="text" name="email" size="40" value="<?= $fgmembersite->UserEmail() ?> "><br><br> Address:<br> <input type="text" name="address" size="40" value="<?= $fgmembersite->UserAddress() ?> "><br><br> <button>Submit</button>my editform.php <?php $con = mysqli_connect("localhost","root","user","pass"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } mysqli_query($con,"UPDATE fgusers3 SET name = '".$_POST['name']."', email= '".$_POST['email']."', address= '".$_POST['address']."' WHERE id_user='".$_POST['id_user']."'"); header("Location: test.php"); ?> Similar TutorialsSir/ma'am,
With the script I'm using to run my website, I've been trying to add an additional feature for the users to add/edit. I'll try to provide as much info as I can, hopefully it'll help.
Here is the code I'm using to display the user's unique info from the db.
<a class="wallet-edit"><?php echo $_SESSION['simple_auth']['INFO']?></a>That displays the user's info from the column 'INFO' perfectly. It's also a js popup to a menu to where I'm hoping to add a single textbox to edit the INFO. The script uses a similar function to edit the password with a popup. I've tried modifying the code to edit the INFO column but it doesn't work. Here is the default code it has to edit the password. I'm not sure if it can be changed to edit another column or needs a new piece of code for that. // user edit $('body').on('click', '.username-edit', function() { $('#modal').html(' '); var output = '<div class="modal-content"><h5><?php echo lang::get("Change password")?></h5><hr />'; output += '<h5><?php echo lang::get("New password:")?></h5><input type="password" name="password" id="password" value="" class="text ui-widget-content ui-corner-all" />'; output += '<h5><?php echo lang::get("Confirm password:")?></h5><input type="password" name="password2" id="password2" value="" class="text ui-widget-content ui-corner-all" />'; output += '</div>'; output += '<div class="modal-buttons right">'; output += '<button id="confirm-button" type="button" class="nice radius button"><?php echo lang::get("Change")?></button>'; output += '</div>'; output += '<a class="close-reveal-modal"></a>'; $('#modal').append(output); $('#second_modal').hide(); $('#modal').reveal(); $('#confirm-button').click(function(){ $('#password').css('border-color', '#CCCCCC'); $('#password2').css('border-color', '#CCCCCC'); var password = $('#password').val(); var password2 = $('#password2').val(); if(typeof(password) === 'undefined' || password == ''){ $('#password').css('border-color', 'red'); return false; } if(password != password2){ $('#password2').css('border-color', 'red'); return false; } password_data = encodeURIComponent(password); $.post("<?php echo gatorconf::get('base_url')?>", { changepassword: password_data} ).done(function(data) { // flush window.location.href = '<?php echo gatorconf::get('base_url')?>'; }); }); });If the code above can be edited to work with what I'm trying to do, it of course only needs one textbox and doesn't have to be confirmed by a second input. Please help! Thanks! Hello I'm trying to set up a user area for my site where it displays the current logged in users ranking and other information in the future. <? ini_set('display_errors', 1); require_once "header.php"; $sql = "SELECT * FROM users WHERE username = ?"; if($stmt = mysqli_prepare($link, $sql)){ mysqli_stmt_bind_param($stmt, 's', $_SESSION['username']); if(mysqli_stmt_execute($stmt)){ $info = mysqli_fetch_array($stmt); echo "Current rank:" . $info['rank']; } else { echo "Can't find user"; } } mysqli_stmt_close($stmt); ?> That's the code I currently have but it gives me the error "but get an error message of mysqli_fetch_array() expects parameter 1 to be mysqli_result" well I know the standard way of retrieving mysql data was through the following codes: Code: [Select] $query = "SELECT * FROM {$tablename} WHERE columnmame = '{$var}'"; $result = mysql_query($query); $row = mysql_fetch_array($result); This will return all properties inside a table row by an associative array indexed by column names. I am, however, wondering if there is an easier way to retrieve database info from more than one table. For now, what I am doing is: Code: [Select] $result = mysql_query( "SELECT * FROM {$tablename} WHERE columnmame = '{$var}'"); $row = mysql_fetch_array($result); $result2 = mysql_query( "SELECT * FROM {$tablename2} WHERE columnmame2 = '{$var2}'"); $row2 = mysql_fetch_array($result2); which is a bit tedious and can cause problems when two or more coders work on the same project(it will be difficult to tell what is $row1, $row2 and $row3...). Is there away to write a simpler code than the one above? I mean, if it is possible to run mysql_fetch_array only once and retrieve database info from multiple tables? i am a beginerr in php.. and here is my code..which shows error in the querry line.. erro goes like this Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs\restafinal\process_edit_page.php on line 56 and code goes like this.. echo part works well...that query line is the error line..please tell me whats the problem... Code: [Select] <?php //$id=$_GET["id"]; $id= $_GET['id']; $menu_name= $_POST['menu_name']; $position= $_POST['position']; $visible= $_POST['visible']; $note= $_POST['note']; $content= $_POST['content']; //echo part works well.. echo "menu_name"; echo $menu_name; echo "<br/>"; echo "position"; echo $position; echo "<br/>"; echo "visible"; echo $visible; echo "<br/>"; echo "note"; echo $note; echo "<br/>"; echo "id"; echo $id; echo $content; [b]$result = mysql_query(UPDATE page SET note =$note, nevigation = $menu_name WHERE id = $id,$connection)[/b] // test to see if the update occurred if (mysql_affected_rows() == 1) { // Success! } else { $message = "The page could not be updated."; $message .= "<br />" . mysql_error(); } ?> I'm creating a game where 2 people, on separate computers can battle each other. I'm doing it turn-based, like Final Fantasy but I came across a problem, how do I check if the other person has ended their turn? I was thinking that I would have an area in my database that would be true/false if it was their turn. So if the first person ends their turn, their 'turn' becomes false in the database, but how, on the other users computer, do I constantly check if the 'turn' has become false so that they may now play without having to keep updating the browser. Or is their a better way to do something like this? I'm trying to get a simple javascript popup script going anytime the database is updated in real-time. I'm not sure as to what to do next, because I'm still a newbie with jQuery and ajax, but the following code is what I have right now:
PHP MySQL query page:
<?php $con = mysqli_connect('localhost','root','root','mydb'); if (!$con) { die('Could not connect: ' . mysqli_error($con)); } mysqli_select_db($con,"mydb"); $sql="SELECT * FROM incoming_calls"; $result = mysqli_query($con,$sql); while($row = mysqli_fetch_array($result)) { $callArray[] = array('phonenumber' => $row['phone_number'], 'id' => $row['phone_login_id']); } if (!empty($callArray)) { //echo json_encode($callArray); for ($i = 0; $i < count($callArray); ++$i) { print $callArray[$i]['id'] . ": " . $callArray[$i]['phonenumber'] . "<br>"; } } mysqli_close($con); ?>MySQL "incoming_calls" db table (I have a node.js script, that draws SMDR data from a phone system and posts it to this table): id phone_number phone_login_id date_created 3 000-000-0000 1225 12/15/2014 14:53 6 000-000-0000 1222 12/15/2014 14:53 9 000-000-0000 1202 12/15/2014 14:53 12 000-000-0000 1201 12/15/2014 14:55 18 000-000-0000 1232 12/15/2014 14:55 21 000-000-0000 1222 12/15/2014 14:57 24 000-000-0000 1222 12/15/2014 14:57 27 000-000-0000 1201 12/15/2014 14:58 30 000-000-0000 1207 12/15/2014 14:58 33 000-000-0000 1212 12/15/2014 14:59HTML ajax call page: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Phone calls</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> </head> <body> <script language="javascript" type="text/javascript"> function getCall(){ $.get("phonecall.php", function(data){ $("#call").html(data); }); } setInterval(getCall,5000); </script> <div id="call"></div> </body> </html>Any help with this is greatly appreciated! Thanks ahead of time! Edited by Juan1989, 16 December 2014 - 11:07 AM. I have created a form that i can see the form input info in to the form boxes but once submitted it is not updating or adding new input to the database. I am trying to keep it as simple as possible. I am also new at PHP.
Here is my code:
<?php // define variables and set to empty values $amp_20_parts_idErr = $part_numberErr = $locationErr = $quantityErr = ""; $amp_20_parts_id = $part_number = $discription = $location = $quantity = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["amp_20_parts_id"])) { $amp_20_parts_idErr = "ID is required."; } else { $amp_20_parts_id= test_input($_POST["amp_20_parts_id"]); } if (empty($_POST["part_number"])) { $part_numberErr = "Part number is required."; } else { $email = test_input($_POST["part_number"]); } if (empty($_POST["description"])) { $descriptionErr = ""; } else { $description = test_input($_POST["description"]); } if (empty($_POST["location"])) { $locationErr = "A location is required."; } else { $location = test_input($_POST["location"]); } if (empty($_POST["quantity"])) { $quantityErr = "Quantity is required"; } else { $quantity = test_input($_POST["quantity"]); } } function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } ?> <div id="update_form"> Please follow instructions for updating the data base.<br>instructional text goes here.<br/><br/> <table><tr><form method="POST" action="new path"> <td>ID: <input name="amp_20_parts_id" type="text"><span><?php echo $amp_20_parts_idErr; ?></span><br/><br/></td> <td>Part Number: <input name="part_number" type="text"><span><?php echo $part_numberErr; ?></span><br/><br/></td> <td><label>Discription: <textarea name="description" rows="3" col="20"></textarea> <br/><br/></td> <td>Location: <input name="location" type="text"><span><?php echo $locationErr;?> </span><br/><br/></td> <td>Quantity: <input name="quantity" type="text"><span><?php echo $quantityErr; ?> </span><br/><br/></td><br/> <td><input type="submit"></td> </form></tr></table> <?php $con=mysqli_connect("server","user","password","db"); // Check connection if (mysqli_connect_errno()) { echo("Connect failed: %s\n", mysqli_connect_error()); // escape variables for security $amp_20_parts_id = mysqli_real_escape_string($con, $_POST['amp_20_parts_id']); $part_number = mysqli_real_escape_string($con, $_POST['part_number']); $discription = mysqli_real_escape_string($con, $_POST['description']); $location = mysqli_real_escape_string($con, $_POST['location']); $quantity = mysqli_real_escape_string($con, $_POST['quantity']); $sql="INSERT INTO amp_20 (amp_20_parts_id, part_number, description, location, quantity) VALUES ('$amp_20_parts_id', '$part_number', '$description', '$location', '$quantity')"; if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); } echo "1 record added"; mysqli_close($con); } ?> I'm currently trying...struggling....to teach myself PHP and I'm really bugged with this database stuff. I am slowly managing but I'm a tad bit stuck now. I want to show a specific piece of information from a table. Lets say my table is structured like so: id user email 1 Bob Bob@Name.com 2 Fred Fred@Name.com 3 Matt Matt@Name.com What would I need to do to display ONLY Freds user? One way I tried only displayed the first rows info (Bob) the second way I tried (with a while loop) only displayed the last rows info (Matt) Heres my current code: <html> <body> <?php include 'dbwire.php'; $query = mysql_query('SELECT * FROM user'); $row = mysql_fetch_array($query); while ($row = mysql_fetch_array($query)) { echo '<b>User:</b> ' . $row['user'] . '<br />'; } ?> </body> </html> Hi, I'm working with sessions for the first time and have been able to put a member's id into the database. However, when I try and put their display name into the database I got a message saying Unknown column 'xyz' in 'field list' xyz was the display name for the session. Just can't seem to see what I'm doing wrong. In the code below, I even tried changing $_SESSION['member_display_name'] to $_SESSION['member_id'], in which case the correct id was inserted into both the member_id and the member_display_name fields in the database, so I know the table is set up correctly. Any tips? Code: [Select] //**********************SEND TO DATABASE**************************** include 'mysql_connect.php'; $query = "INSERT INTO uploads (date, member_id, upload_name, upload_title, upload_type, subject, topic, year, status, keywords, description, member_display_name, firstname, lastname)" . "VALUES (NOW(), ".$_SESSION['member_id'] . ",'$upload_nameX', '$upload_title', '".$EXPLODED_STRING[1]."', '$subject', '$topic', '$year', '$status', '$keywords', '$description', ".$_SESSION['member_display_name'] . ", '$firstname', '$lastname')"; //if($query){echo 'data has been placed'} mysql_query($query) or die(mysql_error()); $upload_id = mysql_insert_id(); //***********************END OF DATABASE CODE*********************** Hello all, I have a directory page that is populated with a foreach loop pulling info from a db table. I want to make a "Download Directory pdf" button that will print out the directory entries in a nicely formatted way. The thing is that the foreach loop uses an OO call to what every template is being used for the HTML display: foreach ( (array) $results as $row) { ... $out .= '<div class="cn-list-row' . $alternate . ' vcard ' . $template->slug . ' ' . $entry->getCategoryClass(TRUE) . '">' . "\n"; $out = apply_filters('cn_entry_before', $out, $entry); ob_start(); include($template->file); $out .= ob_get_contents(); ob_end_clean(); $out = apply_filters('cn_entry_after', $out, $entry); $out .= '</div>' . "\n"; } $out .= '<div class="clear"></div>' . "\n"; $out .= '</div>' . "\n"; $out = apply_filters('cn_list_after', $out, $results); return $out; } Any Ideas?? Well, I have been able to create a registration and login page. Now I am trying to make an "Edit Profile" page but I can't seem to be able to pull up their primary key field which is called "userID" and I need help doing this. How would I get it from the MySQL database? Hello, I'm fairly new to PHP, and I'm looking to create an online catalog for a furniture/appliance store. I'm wondering the best way to go about this. I'm looking at SQLMaestro's "PHP Generator for MySQL" http://www.sqlmaestro.com/products/mysql/phpgenerator/ ... But, I'm curious if you guys can point me in the right direction. I've never created a database before, and I want to do it the way that makes the most sense... Any advice would be appreciated!! When a user logs in to my members area, their online status is set to 2 in my database and they are displayed as online for everyone else to see. And when they click log out their online status is set to 1 and they are no longer shown as online. My problem is when the session expires due to inactivity, the database isnt updated and they are still shown as online. So whenever the access a page in the members area I have made it so that time also gets entered into the database. And my goal is to have the users online page auto refresh every 5 minutes to check the current time against the time stored in the database for that user and if 15 minutes has past, have the online status in the database updated to 1 again. im using pdo but im a novice at it and havnt been able to find much help on google. Is there a way i can use an if statement to check the two times and only update the online field to 1 for the inactive users while leaving the users who appear active as 2? Sorry if this was confusing, i wasnt too sure how to word it properly. Hey All, Been banging my head into the wall on this one. I have 2 tables one for users 'myMembers' and one for products 'products'. Each table has a auto increment id. The myMembers id is the user id and the products table id is for the product id. I have a row in the products table for agent_id. I would like the agent_id to be filled with the id from the myMembers table. I took a look at the manual; still do not understand how to take the id from the myMembers table then place that id into the agent_id; so the products(id) can be listed under the specific members id(agent_id) in the products table. So far my script for the products table inserts items correctly, but does not file under the specific agent_id. Here is the script for entering items to the products table. Thanks for the guidance! <?php // Script Error Reporting error_reporting(E_ALL); ini_set('display_errors', '1'); ?> <?php // Delete Item Question to Admin, and Delete Product if they choose if (isset($_GET['deleteid'])) { echo 'Do you really want to delete product with ID of ' . $_GET['deleteid'] . '? <a href="inventory_list.php?yesdelete=' . $_GET['deleteid'] . '">Yes</a> | <a href="inventory_list.php">No</a>'; exit(); } if (isset($_GET['yesdelete'])) { // remove item from system and delete its picture // delete from database $id_to_delete = $_GET['yesdelete']; $sql = mysql_query("DELETE FROM products WHERE id='$id_to_delete' LIMIT 1") or die (mysql_error()); // unlink the image from server // Remove The Pic ------------------------------------------- $pictodelete = ("../inventory_images/$id_to_delete.jpg"); if (file_exists($pictodelete)) { unlink($pictodelete); } header("location: inventory_list.php"); exit(); } ?> <?php // Parse the form data and add inventory item to the system if (isset($_POST['product_name'])) { $product_name = mysql_real_escape_string($_POST['product_name']); $price = mysql_real_escape_string($_POST['price']); $category = mysql_real_escape_string($_POST['category']); $subcategory = mysql_real_escape_string($_POST['subcategory']); $details = mysql_real_escape_string($_POST['details']); // See if that product name is an identical match to another product in the system $sql = mysql_query("SELECT id FROM products WHERE product_name='$product_name' LIMIT 1"); $productMatch = mysql_num_rows($sql); // count the output amount if ($productMatch > 0) { echo 'Sorry you tried to place a duplicate "Product Name" into the system, <a href="inventory_list.php">click here</a>'; exit(); } // Add this product into the database now $sql = mysql_query("INSERT INTO products (product_name, agent_id price, details, category, subcategory, date_added) VALUES('$product_name','$price','$details','$category','$subcategory',now())") or die (mysql_error()); $pid = mysql_insert_id(); // Place image in the folder $newname = "$pid.jpg"; move_uploaded_file( $_FILES['fileField']['tmp_name'], "../inventory_images/$newname"); header("location: inventory_list.php"); exit(); } ?> <?php // This block grabs the whole list for viewing $product_list = ""; $sql = mysql_query("SELECT * FROM products ORDER BY date_added DESC"); $productCount = mysql_num_rows($sql); // count the output amount if ($productCount > 0) { while($row = mysql_fetch_array($sql)){ $id = $row["id"]; $product_name = $row["product_name"]; $price = $row["price"]; $date_added = strftime("%b %d, %Y", strtotime($row["date_added"])); $product_list .= "Product ID: $id - <strong>$product_name</strong> - $$price - <em>Added $date_added</em> <a href='inventory_edit.php?pid=$id'>edit</a> • <a href='inventory_list.php?deleteid=$id'>delete</a><br />"; } } else { $product_list = "You have no products yet"; } ?> Hi there everyone. I'm really confused about this as I want to email eveyone in my DB when a new Event is created by a member. I have a test code which I used to make sure it works and it sends to 5 email addresses (which is all of them) in the test table. This works fine. All members with a 0 get the mail. So I now just took the code and changed the table name (obviously!!) and put it in my live site which has 50 members so far. It now doesn't send any emails??? Not sure why this is as the code is exactly the same (except the table name). $result = mysql_query("SELECT email FROM membership WHERE send_as_email = '0'"); while ($row = mysql_fetch_array($result)) { sendMail($row[0]); } mysql_free_result($result); function sendMail($to){ $subject = 'New Event Created; $message = "Hi there,\n Just letting you know of a new Event that has been created.\n Title: $title\n Town: $town\n Date: $date_convert\n For more details or to attend this Event, please login \n Many thanks\n The Team\n \n ****************************************************************************\n THIS EMAIL IS AUTOMATED. DO NOT REPLY.\n To turn notifications off, change the notification settings in your Profile.\n ****************************************************************************\n"; $headers = 'From: members@mysite.co.uk' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); } Hi Im having some trouble implementing info into a database Hello folks I am new to php and I have been trying to put together a database that a user can search and choose from the results. I have managed to make this script by copying code from google searches and trial and error. The script so far has been tested and works. The hard part is the code for choosing from the results, I have tried some things but I have been far from the mark, the thing is I can't get my head around the problem, if the first field is a number which is unique to each row, how can I pick that up in a php argument. I have tried making the first field an href link to send that number to a different table which would collect the results of the users choices, but I'm just not sure what to put in the code. Could someone throw me a lifeline here I've searched for hours on google to find any code that looks like it would work with no luck. // Get the search variable from URL $var = @$_GET['a'] ; $trimmed1 = trim($var); //trim whitespace from the stored variable $var = @$_GET['b'] ; $trimmed2 = trim($var); $var = @$_GET['c'] ; $trimmed3 = trim($var); $var = @$_GET['d'] ; $trimmed4 = trim($var); $var = @$_GET['e'] ; $trimmed5 = trim($var); $var = @$_GET['f'] ; $trimmed6 = trim($var); //connect to your database mysql_connect("localhost","root",""); //(host, username, password) //specify database mysql_select_db("a2149809_MV") or die("Unable to select database"); //select which database we're using // Build SQL Query $query = "SELECT * FROM `table` WHERE `field1` LIKE \"%$trimmed1%\" AND `field2` LIKE \"%$trimmed2%\" AND `field3` LIKE \"%$trimmed3%\" AND `field4` LIKE \"%$trimmed4%\" AND `field5` LIKE \"%$trimmed5%\" AND `field6` LIKE \"%$trimmed6%\" order by `field1`"; $result=mysql_query($query); $num=mysql_num_rows($result); mysql_close(); <table width="100%" border=2 cellspacing=2 cellpadding=2> <tr><form name="form" action="" method="get"> <td colspan="6"><input type="submit" name="Submit" value="Search" /> </td> </tr> <tr> <td><input type="text" name="a" value="" size="4" /></td> <td><input type="text" name="b" value="" size="40" /></td> <td><input type="text" name="c" value="" size="3" /></td> <td><input type="text" name="d" value="" size="10" /></td> <td><input type="text" name="e" value="" size="10" /></td> <td><input type="text" name="f" value="" size="10" /></td> </form></tr> <?php $i=0; while ($i < $num) { $f1=mysql_result($result,$i,"Field1"); $f2=mysql_result($result,$i,"Field2"); $f3=mysql_result($result,$i,"Field3"); $f4=mysql_result($result,$i,"Field4"); $f5=mysql_result($result,$i,"Field5"); $f6=mysql_result($result,$i,"Field6"); ?> <tr> <td><?php echo $f1; ?></td> <td><?php echo $f2; ?></td> <td><?php echo $f3; ?></td> <td><?php echo $f4; ?></td> <td><?php echo $f5; ?></td> <td><?php echo $f6; ?></td> </tr> <?php $i++; } ?> </table> less than 6 characters. I think it's the way my code is ordered. I've tried switching the commands around, no luck. Help please. Code: [Select] <?php //begin register script $submit = $_POST['submit']; //form data $username= strip_tags ($_POST['username']); $email= strip_tags($_POST['email']); $pwd= strip_tags($_POST['pwd']); $confirmpwd= strip_tags($_POST['confirmpwd']); $date = date("Y-m-d"); if ($submit) { //check for required form data if($username&&$pwd&&$confirmpwd&&$email) { //check length of username if (strlen($username)>25||strlen($username)<6) { echo "<p class='warning'>username must be bewteen 6 and 25 characters</p>"; } else { //check password length if (strlen($pwd)>25||strlen($pwd)<6) { echo "<p class='warning'>password must be between 6 and 25 characters</p>"; } else { //register the user echo "<p class='success'>Thanks for signing up!</p>"; } } //check if passwords match if ($pwd==$confirmpwd) { } else { echo "<p class='warning'>your passwords do not match</p>"; } //encrypt password $pwd = md5($pwd); $confirmpwd = md5($confirmpwd); //open database $connect = mysql_connect("xxxxxxxx", "xxxxxxxx", "xxxxxxxx"); mysql_select_db("digital"); //select database //register the user $queryreg = mysql_query(" INSERT INTO users VALUES ('','$username', '$email', '$pwd') "); die("<p class='success'>Thank you for signing up you have been registered"); } else { echo "<p class='warning'>please fill in all fields</p>"; } } ?> I have two tables. Table Name:Users Fields: User_name user_email user_level pwd 2.Reference Fields: refid username origin destination user_name in the users table and the username field in reference fields are common fields. There is user order form.whenever an user places an order, refid field in reference table will be updated.So the user will be provided with an refid Steps: 1.User needs to log in with a valid user id and pwd 2.Once logged in, there will be search, where the user will input the refid which has been provided to him during the time of order placement. 3.Now User is able to view all the details for any refid 3.Up to this we have completed. Query: Now we need to retrieve the details based on the user logged in. For eg: user 'USER A' has been provided with the referenceid '1234' during the time of order placement user 'USER B' has been provided with the referenceid '2468' during the time of order placement When the userA login and enter the refid as '2468' he should not get any details.He should get details only for the reference ids which is assigned to him. My data input form is not working with the first few people who have tried to use it. I think it is because they are putting ' or " or some other character that is not allowed into the database. Any ideas how I can fix it? |