Jump to content

Search the Community

Showing results for tags 'mysql'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

  1. ok, just quick... im getting this when trying to login: Unknown column 'e5035533a816cac4c54012281f58543d' in 'where clause' and this is my takelogin.php file: /*==========RUN LOGIN PROCEDURE===============*/$uname = sqlesc($_POST['username']); /*Form Names...*/$pass = sqlesc($_POST['password']); /*Form Names...*/if(isset($pass)){$passhash = md_5($pass); /*Securing The Data...*/}$query = "SELECT * FROM users WHERE username = $uname AND passhash = $passhash AND enabled = 'yes' AND status = 'confirmed'";$query_result = mysql_query($query)or die(mysql_error());//Running query to the DB...if(mysql_num_rows($query_result) == 1)/*if the DB returns somfthing, then run...*/{$row = mysql_fetch_array($query_result);$_SESSION['uid'] = $row['u_id'];$_SESSION['username'] = $row['username'];$_SESSION['pass'] = $row['passhash'];$_SESSION['status'] = $row['status'];$_SESSION['enabled'] = $row['enabled'];$_SESSION['email'] = $row['email'];$_SESSION['ip'] = $row['ip'];$_SESSION['class'] = $row['class'];$_SESSION['time_offset'] = $row['time_offset'];$_SESSION['dst_in_use'] = $row['dst_in_use'];$_SESSION['auto_correct_dst'] = $row['auto_correct_dst'];header('Refresh: 3; url=index.php');//with time delay...}else/*Error messeage...*/{$HTMLOUT .= "<center>Error reading login-session coding base, or a wrong username/pass inserted...</center>";header('Refresh: 3; url=index.php');//with time delay...}/*==========RUN LOGIN PROCEDURE===============*/ any ideas? Oo...
  2. Hello internet. I am trying to place the local time in a php table using the code below - it executes but is not displaying the local time EST that I would like - it is still displaying GMT. What am I doing wrong here? Table is ViewColumn for date in mysql is TStampAuto Increment column is M_idgru references with a 3 which is the gru number where I send the persons comments to the Cmnts column //code$result = mysql_query("SELECT * FROM View WHERE gru='3' AND DATE_ADD(NOW(), INTERVAL 2 HOUR) > TStamp ORDER BY M_id DESC");echo "<table border='0'><tr><th>Name</th><th>Comments</th><th>Date & Time</th></tr>";while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['NameC'] . "</td>"; echo "<td>" . $row['Cmnts'] . "</td>"; echo "<td>" . $row['TStamp'] . "</td>"; echo "</tr>"; }
  3. Hi all Expert, I am PHP learner. I want to do something by PHP. My process is below:I have created a form now need to do like this: I will input data by PHP in my database.(I can input only one field data but i need to input multiple field data). Then database's all data will show in other page in & there will show a EDIT button then anyone can update their data by selecting name or ID. Then it will show me welcome page. This process I want to do.
  4. Hello internet I am pulling out my hair trying to figure this one out. Below is the only code I have in the php file. What I am trying to do is delete the only line of data in the database table and replace it with a new line of data. The data will delete but it will not do the insert function to put the new data in. I started out trying an UPDATE function but that did not work either. Separately each set of <?php ?> code works if I put them in separate files but together they do not work. Why? How can I achieve the desired effect? Please help. <?php$con = mysql_connect("xxx","xxx","xxx");mysql_select_db("xxx", $con);mysql_query("DELETE FROM ViewIt WHERE misc='1'");mysql_close($con)?> <?php$con = mysql_connect("xxx","xxx","xxx");mysql_select_db("xxx", $con);$sql="INSERT INTO ViewIt (misc, CC)VALUES ('1', '2')";mysql_close($con)?>
  5. Hello everybody, I have a little problem here...I have a XML file, that is a database itself containing information about terminology in two languages... This exemple file is to be "uploaded" into a MySQL databse, on Ubuntu, which is already built and ready to get the information from the XML files... The thing is: how can I start doing this uploading process? Is shell script a good way? Or is it better to use another tool? How? The file is here, attached. Thank you XML_exemple.mtf.xml
  6. Nice be with you everyone! In MySQL: Is there data type that accepts non-alphanumeric?
  7. Greetings, I am really new at coding php. I have been working for a while and doing some Google searches. I am trying to make a registeration page for something I am working on. I can get everything in the database but dates & times. Right now it's all bogus information. I am curious on how to take a date (like a birthday) and write it to my MySql datebase? Every attempt I have made that is the only piece that doesn't get written. Also I am having an issue with the php date getting into the database. Html code <!DOCTYPE HTML><html><head><title>Demo Game</title></head><body><h1>Test page</h1><p>This is a demo page. More to come.</p><p>In the area below. You will find a location for registration. Please attempt to make an account.</p> <!-- Divide for form formatting --> <div id="container" style="width:250px"><!-- Form for registering new users into the game. --><form id="register" action="reg.php" method="post"> <fieldset> <legend>Registration</legend> <div id="col1" style="width:75px; float:left;"> Username:<br> Password:<br> First name:<br> Last name:<br> Birthday:<br> Email: </div> <div id="input" style="width:100px; float:left;"> <input type"text" name="username" placeholder="Username" required autofocus><br> <input type="password" name="password" placeholder="Password" required><br> <input type"text" name="fname" placeholder="First Name" required><br> <input type"text" name="lname" placeholder="Last Name" required><br> <input type="date" name="bday" placeholder="(MM/DD/YYYY)" required><br> <input type="email" name="email" placeholder="Email address" required> </div> <div id="gender" style="text-align:center; clear:both;"> Gender: <select name="gender"> <option value="Male">Male</option> <option value="Female">Female</option> </select><br><br> </div> <input type="submit" value="Register"> </fieldset></form></div> </body></html> php code <?php// Variables//$Date = now();$User = "";$Password = "";$Database = "testgame";$Table = "players";$Host = "localhost";$sqlDate = date('Y-m-d H:i:s'); //Check to make sure variables are set from index.htmif(isset($_POST[username]) && isset($_POST[password]) && isset($_POST[fname]) && isset($_POST[lname])&& isset($_POST[bday]) && isset($_POST[email]) && isset($_POST[gender])){// Connect to the servermysql_connect($Host, $User, $Password) or die (mysql_error()); //Check connectivitymysql_select_db($Database) or die(mysql_error()); // Insert data into DB$insert = "INSERT INTO $Table (username, password, name, last, email, birthday, registered, gender) VALUES('$_POST[username]', '$_POST[password]', '$_POST[fname]', '$_POST[lname]', '$_POST[email]', '$_POST[bday]', '$sqlDate', '$_POST[gender]')"; //Check to see if the name exists (no duplicates)$result = mysql_query("SELECT * FROM $Table Where email = '$_POST[email]'"); echo $_POST[email]; if($result){ if(!mysql_query($insert)) { die (mysql_error()); echo "Record added. "; }}else { echo "Email already used."; } mysql_close($con); } //End of check ?>
  8. Narcis

    mysqli

    In the lasts months I have try to learn php. I really like w3 because explains the things in a very clear an direct way. But now I discover that I should not use mysql, that this is deprecated. More experienced people tell me that I should use mysqli I'm confused, is it true? why W3Schools does not talk about that? When will w3c update that information? Thank you Narcís
  9. hello everyone, I've got a server set up as my web host. It has Apache installed and PHP (both are the most recent version). for the database I have a different server these two machines (the web host and the database server) are connected through a peer to peer connection. Now I've learned that I need to use my database servers IP address as the host address for my database connection script but are there any other settings I need to change in the php.ini in order to make this work?
  10. Hello. I am experimenting with PHP and MYSQL because I am new at it. I am trying to use AJAX to create a query into a database that I have. It isn't working. I'm sure I've made a mistake but I cant seem to find it. Someone please look over my code and see if there is something I am missing. I know my database is working because I use it to log in. It has to be in my code. The results I get from this is blank. The AJAX does call on the PHP correctly because I do get an echo back, but only because the $results isn't working. query/users.php <?phpinclude('includes/config.inc');$sql = "SELECT * FROM user";$result = mysql_query($sql,$con);if($result){echo "Username <br>";}else{echo "Nothing Found: ". mysql_error();}while($row = mysql_fetch_array($result)){echo $row['username'];echo "<br>";}mysql_close($con);?> /includes/config.ini //Real info has been removed for security <?php$hostname = 'hostname';$dbname = 'databank';$username = 'username';$password = 'password';$con = mysql_connect($hostname, $username, $password) or DIE('Connection failed');mysql_select_db($dbname, $con) or DIE("Database isnt available");?> admin.php <?phpsession_start();include('includes/config.inc');if (!isset($_SESSION['username'])) {header('Location: index.php');}?><script type="text/javascript">function q(url){if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); }else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("q").innerHTML=xmlhttp.responseText; } }xmlhttp.open("GET",url,true);xmlhttp.send();}</script><HTML><head><link rel="stylesheet" type="text/css" href="../css/secure.css"><title>Admin Page</title></head><body><table> <tr> <td class='seven'></td> <td class='fi'>Welcome: <?php echo $_SESSION['username']?> </td> <td class='fi'><a href="logout.php">Logout</a></td> </tr></table>This is the ADMIN page<br><input value="Get Users" type="submit" onclick="q('query/users.php')"><div id="q"></div></body></HTML>
  11. Hello everyone, sorry for the dull title. Couldn't think of anything better. So this is my problem.I was using a registration form for teachers and one for students. There are ten fields in each, first name, last name, username, password, etc being similar whereas departments (teachers have 7, students have 3) and email ids (teachers have a different domain extension and students different) being different. I am using two tables, one for teachers and one for student.Now, I know I can use one login form, query against these two tables using the JOIN property and make them login. But I want to know if this method is efficient because two tables are being used.Or is this method more efficient: In the reg form, I put a radio button to select teacher or student and depending on what one chooses the remaining fields change, i.e, if I choose teacher, 7 departments show up or if I choose student only 3 of them show up. In this way, I have to use one table only, atleast I guess so.Or another possibility is I use two tables but two login forms, one for teacher and one for student, I know this is the easy way out but being a Comp Sci student I want to choose the efficient method of all.P.S: The teacher's role is going to be completely different from the student's in the site. And there will be lot of activities for the teachers and students, they are completely different. Will maintaining one table be a good bet?Thank you.
  12. <?phprequire_once('include.securelogin.php'); $tValue = $_POST['username']; $mysqli = new mysqli($ad_host, $ad_user, $ad_password, "mysql"); if ($mysqli->connect_errno) { printf("Connect failed: %s\n", $mysqli->connect_error); exit();} $tSQL = "select * from `mysql`.`user` where user = \"" . $tValue . "\""; if ($result = $mysqli->query($tSQL) && $result->num_rows > 0) { $result->close(); echo("username#matched");}else { } ?> If I pull $tSQL out of my Netbeans debugger, remove the opening quote and closing quote and run the query I get some results from the table `mysql`.`user`. For some reason nothing is ever returned into the variable $result though. Could this be some kind of permissions problem on the back end of MySQL somewhere? I thought I had a good idea to create some database users with some permissions and query them from `mysql`.`user` with mysqli but it has really not been working out so far. Any suggestions on how to get things working? Thanks!!!
  13. Hi guys, so i've been working on this idea for quite a while now.. the only thing is.. i'm not exactly sure how to do it.. i want to make a automatic request system where you can request phone repair service trough the company website. something like: (DROPDOWN BOX) iPhone(selected) Samsung Nokia Sony Ericsson HTC ( DROPDOWNBOX which will react on first choice, like when i select iPhone something like this should come)iPhone 3(G)SiPhone 4iPhone 4 SiPhone 5 and then ofcourse the 3rd dropdown box where you will be selecting the problem(DROPDOWN BOX)Screen brokenButton doesnt workPhone wont chargeWater damagePhone wont go onSoftware issue and then the selected items gotta be saved in a database or something.. not exactly sure how i'm gonna do that.. (ofcourse there will be more info required to request a repair, like name and adress and all that.. but for now i just wat the dropdown boxes working) Soooooo.... anyways i've made an array with php before.. but i don't know exactly how to make them in combination with if//else like if iphone selected, include.... the other select.. here's what i made so far <html><body> <?php $devices = array('iphone' => 'iPhone', 'samsung' => 'Samsung', 'nokia' => 'Nokia', 'sonyericsson' => 'Sonyericsson', 'htc' => 'HTC',);echo '<form method="post">'; echo '<select>'; foreach($devices AS $key => $value) echo '<option value="'. $key .'">'. $value .'</option>'; echo '</select>'; echo '<input type="submit" value="Submit">'; echo '</form>'; ?></body></html> If someone could help me i would really appriciate it, Thanks guys! Edit: I've tried something with buttons aswell... in combination with javascript.. didn't work out so well <!DOCTYPE html><html><head><script>function iphonebtn() /*The iPhone Buttons*/{document.getElementById("demo").innerHTML= "iPhone";var element = document.createElement("button");document.getElementById("apple").appendChild(element);var element2 = document.createElement("button");document.getElementById("apple").appendChild(element2);var element3 = document.createElement("button");document.getElementById("apple").appendChild(element3);document.getElementById("apple").getElementsByTagName("button")[1].innerHTML="iPhone 5";document.getElementById("apple").getElementsByTagName("button")[2].innerHTML="iPhone 4";document.getElementById("apple").getElementsByTagName("button")[3].innerHTML="iPhone 4s"; /*document.getElementById("apple").onclick = function(){ alert ("please choose problem")};*/};/*The Samsung Buttons*/function samsungbtn(){document.getElementById("demo2").innerHTML= "Samsung";var element4 = document.createElement("button");document.getElementById("samsung").appendChild(element4);var element5 = document.createElement("button");document.getElementById("samsung").appendChild(element5);var element6 = document.createElement("button");document.getElementById("samsung").appendChild(element6);document.getElementById("samsung").getElementsByTagName("button")[1].innerHTML="Galaxy SII";document.getElementById("samsung").getElementsByTagName("button")[2].innerHTML="Galaxy SIII";document.getElementById("samsung").getElementsByTagName("button")[3].innerHTML="Galaxy S Advance"; /*document.getElementById("samsung").onclick = function(){ alert ("please choose problem")};*/ }; /*The HTC Buttons*/ function htcbtn(){ document.getElementById("demo4").innerHTML= "HTC";var element10 = document.createElement("button");document.getElementById("htc").appendChild(element10);var element11 = document.createElement("button");document.getElementById("htc").appendChild(element11); var element12 = document.createElement("button");document.getElementById("htc").appendChild(element12);document.getElementById("htc").getElementsByTagName("button")[1].innerHTML="HTC one X";document.getElementById("htc").getElementsByTagName("button")[2].innerHTML="HTC one V";document.getElementById("htc").getElementsByTagName("button")[3].innerHTML="HTC one S"; /*document.getElementById("htc").onclick = function(){ alert ("please choose problem")};*/}; /*The defect Buttons*/ function defectbtn(){document.getElementById("demo3").innerHTML= "Problem";var element7 = document.createElement("button");document.getElementById("glass").appendChild(element7);var element8 = document.createElement("button");document.getElementById("glass").appendChild(element8); var element9 = document.createElement("button");document.getElementById("glass").appendChild(element9);document.getElementById("glass").getElementsByTagName("button")[1].innerHTML="Water Damage";document.getElementById("glass").getElementsByTagName("button")[2].innerHTML="Phone wont Charge";document.getElementById("glass").getElementsByTagName("button")[3].innerHTML="Button doesn't work"; };</script></head><body> <font face="arial" size="4" color="blue"> Kies uw telefoon </font><div id="apple"><button id="demo" type="button" onclick="iphonebtn(),defectbtn(),this.disabled = 'disabled';"> iPhone </button></div><br /><div id="samsung"><button id="demo2" type="button" onclick="samsungbtn(),defectbtn(),this.disabled = 'disabled';"> Samsung </button></div><br /> <div id="htc"><button id="demo4" type="button" onclick="htcbtn(),defectbtn(),this.disabled = 'disabled';"> HTC </button></div><br /> <div id="glass"><button id="demo3" type="button" onclick="defectbtn(),this.disabled = 'disabled';"> Problem </button></div><br /> <h1>Reparatie aanvragen</h1> <p></p> <form name='registration' onSubmit="return formValidation();"> <ul> <li><label for="userid">ID (indien bekend)</label></li> <li><input type="text" name="ID" size="12" /></li> <li><label for="username">Voornaam:</label></li> <li><input type="text" name="username" size="50" /></li> <li><label for="address">Adres:</label></li> <li><input type="text" name="address" size="50" /></li> <li><label for="country">Land:</label></li> <li><select name="country"> <option selected="" value="Default">(Selecteer een Land)</option> <option value="AF">Nederland</option> <option value="AD">België</option> </select></li> <li><label for="zip">Postcode:</label></li> <li><input type="text" name="zip" /></li> <li><label for="email">Email:</label></li> <li><input type="text" name="email" size="50" /></li> <li><label>Language:</label></li> <li><label for="desc">Bijzonderheden:</label></li> <li><textarea name="desc" id="desc"></textarea></li> <li><input type="submit" name="submit" value="Submit" /></li> </ul> </form></body></html>
  14. I'm a senior HP Unix Systems Engineer, but I've never developed an actual web-based application.<b> I run Windows and Linux at home.<b> I have my own home-built SAN.<b> I did some basic MySQL installation and setup at work.<b> I have fairly decent SQL skills.<b> I want to create my own online application, but that application will need a very fast, back-end processing engine.<b> I am heavy into shell scripting, but that's not going to be fast enough to process the amount of data that I envision for this app.<b> I need to learn some kind of simple, yet powerful compiled language.<b> I started studying C++ 2 days ago, and so far, it looks fairly straight-forward and not too difficult.<b> What other "tools" do I need, in order to allow the new C++ programs to query and manipulate the actual MySQL database?<b> SQL by itself won't do it, PHP won't do it, as it's not compiled, and won't be fast enough to process the data in a timely manner.<b> At this time, I'm planning to build the web-based front-end using HTML and PHP.<b> I'm planning to use MySQL as the database itself.<b> Linux will of course be the O/S of choice.<b> I want to get this project off the ground as quickly as possible, so any advice or suggestions would be greatly appreciated.<b> Thanks in advance, and have a very happy holiday season.
  15. i want to fetch data from multiple tables. they all are similar that is they have same colum names (catalog_product_flat_1,catalog_product_flat_ 2,catalog_product_flat_ 3,catalog_product_flat_ 4.......), but they are not related.Is there any way to do this through stored prcedures or any other way. One more thing these tables will increse in future as the stores of my ecomerce site increases..please help me i am new to this...
  16. Hello everyone!I have a few questions, I have taken on a project this week that is kinda complex. My first question regarding this script is this: I am going to have a forum with a few drop downs text fields and text boxes and check boxes/selections. for this example lets say there is a total of 12 elements (from the above list) Thats the easy part no what i need to do is. I am going to have a $var that can be anything from 1 to 150, now i need the forum drop downs text fields, text boxes and check boxes/selections to repeat with in that forum for the amount of $var. Then when all that info is field out i need it to post to a mysql db. What i dont understand how to do is make php rename all the name boxes for each example by default i will have: |--fname--|--lname--|--start_date--| --end_date--|--night--| and so on.... So what im assuming i need to do is make php do (with $var being 3)... |--fname--|--lname--|--start_date--| --end_date--|--night--| and so on....|--fname1--|--lname1--|--start_date1--| --end_date1--|--night1--| and so on....|--fname2--|--lname2--|--start_date2--| --end_date2--|--night2--| and so on.... And how do i get my php insert mysql script to dynamically know names of the fields (fname, fname1, fname2....and so on) and have them stored in mysql. Thank you for the help!Kelly
  17. Hey everyone! i am trying to fetch data from different file locations, every time there is a new location like this /5/3/539238_375049019231475_1212083119_n.jpg/3/0/309320_396625203733616_1897402511_n.jpg/n/i/nike.jpg I want to get data from all these locations in a single query, how do i get it? Please help me..
  18. Im trying to upload a file to mysql using php and for some reason it doesnt work...could anyone help please..thanks in advance //Here goes the db connection //check for file upload if(isset($_FILES['csv_file']) && is_uploaded_file($_FILES['csv_file']['spredSheet'])){ //upload directory $upload_dir = "csv_dir/"; //create file name $file_path = $upload_dir . $_FILES['csv_file']['name']; echo ($_FILES['csv_file']); //echo "asd"; //move uploaded file to upload dir if (!move_uploaded_file($_FILES['csv_file']['tmp_name'], $file_path)) { //error moving upload file echo "Error moving file upload"; } //open the csv file for reading $handle = fopen($file_path, 'r'); //turn off autocommit and delete the product table mysql_query("SET AUTOCOMMIT=0"); mysql_query("BEGIN"); mysql_query("TRUNCATE TABLE $table") or die(mysql_error()); while (($data = fgetcsv($handle, 1000, ',')) !== FALSE) { //Access field data in $data array ex. $name = $data[0]; $quantity = $data[1]; //Use data to insert into db $sql = sprintf("INSERT INTO product_table (product_name, product_quantity) VALUES ('%s',%d)", mysql_real_escape_string($name), $quantity ); mysql_query($sql) or (mysql_query("ROLLBACK") and die(mysql_error() . " - $sql")); } //commit the data to the database mysql_query("COMMIT"); mysql_query("SET AUTOCOMMIT=1"); //delete csv file unlink($file_path); }
  19. i have 2 tables:1) father table.. (posts table)2)child table.. (comments table)now i ordered the results by (id of father) desc.....now what i want is if comment on some post,,,this post is being the first in the order!..any help please ?what query to use?
  20. Net123

    how they do it

    hello anyone could please explain me how they doing this ?AUTOLOGIN URLhttp://wapzan.com/au...ODYzN2M3/229700 MAIN EDITORhttp://wapzan.com/ed...k3M/root/395384 i having a doubt for a long time how they doing up this "how they ordering codes one by one "?i know they used mysql for order these kinds but what is their basic program for order one by onelike if there was in (Main EDITOR)1st code2nd code3rd code4th code if i tried a insert some codes before 2nd they moving all the things to afterwards ....they doing this again and again really what was happening inside how they marking this orders ???
  21. I used a select statement and found a record in DB, When I tried to update the record, returned 0 rows and not updated. Here is the code. Please help.$query="SELECT classtype,startdate,enddate,classstatus from class where classname = '$classnameval'"; $result = mysql_query($query); echo "select class sql $query</br>"; $num_rows = mysql_num_rows($result); if (!$num_rows) { echo nl2br("Class $classname not in DB\n"); goto bye; } if ($result) { $row = mysql_fetch_array($result, MYSQL_ASSOC); $classtypeo = $row['classtype']; $classstatuso = $row['classstatus']; $sdateo = $row['startdate']; $edateo = $row['enddate']; echo "<h2>Class '$classname' found</h2>\n";var_dump($classstatuso,$sdateo,$edateo,$classtypeo); } else { echo "<h2>Sorry, unable to change class $classname </h2>\n"; goto bye; }var_dump($classstatusval,$sdate,$edate,$classtype); if ($classstatusval == '') $classstatusval = $classstatuso; if ($classtype == '') $classtype = $classtypeo; if ($edate == '') $edate = $edateo; if ($sdate == '') $sdate = $sdateo; $query="UPDATE class SET classstatus = '$classstatusval', startdate = '$sdate', enddate = '$edate', classtype = '$classtype', where classname = '$classnameval'"; $result = mysql_query($query); echo "update class sql $query</br>"; $num_rows = mysql_num_rows($result); if (!$num_rows)// if (!$mysql_num_rows($result)) { echo nl2br("Class $classname not in DB\n"); goto bye; }
  22. how can i connect asp with mysqlfor example if i want to send first name and last name into the columns of mysql so what will be the code . thanks
  23. BigD

    SQL error

    In the following code why gdate has the value of 12-08-13? could that cause sql error? or could the picture field(which is a thumb nail picture) cause the error?I have used the date("y-m-d") before and I was getting 2012-08-12. $gdate = date("y-m-d"); echo "gdate is $gdate"; $query = "INSERT INTO graduate(fname, lname, phone, email, picture, startdate, ". "gdate, gender, stdid, classid, intid) values('$fname', '$lname', '$phone', '$email', ". "'$picture', '$startdate', '$gdate', '$gender', '$stdid', '$classid', '$intid')"; echo "insert grad SQL is $query"; $result = mysql_query($query); if ($result) { echo "<h2>Student $fname $lname graduated</h2>\n"; } else { echo "<h2>SQL error</h2>\n". mysql_error(); }
  24. Hey guys, I've been learning to build websites through w3schools and I've come to my first problem. I am trying to transfer across my sql database to another computer. I believe I have performed the sql dump successfully as I have a small sql file in my bin directory. But when I saved it to disk and inserted into the bin directory on the other computer it doesn't seem to be found. Could someone please confirm that this is the correct syntax to be used: "mysql dump -u [user] -p [password] [db name] < [db name.sql]". Note; i do not use the brackets in the actual syntax. Also does the version of mysql have to be exactly the same for the import to work?
  25. I just inserted a row into my db, how do I retrieve the row key?Here is the code: $query = "INSERT INTO student (graduatedate,lastname,firstname, gender,classid,address, city, state, zip, phone, altphone, email,ssn, dob, picture, lboxname, lbdeposit) " . " VALUES ('na','$lastname', '$firstname', '$gender','$classid','$address', '$city', '$state', '$zip', '$phone', '$altphone','$email','$ssn', '$dob', '$thumbnail','$lboxname', '$lbdeposit')"; $result = mysql_query($query);echo "<h2> Here is the result on student db= $stdid, $lastname ,$firstname,$gender,$classid,$address,$city,$state, $zip,$phone,$altphone,$email,$ssn,$dob,$lboxname,$lbdeposit</h2>\n"; if ($result) { echo "<h2>Student added</h2>\n"; $query = "SELECT $stdid, $classid from student where lastname= '$lastname' and firstname= '$firstname'"; } else { echo "<h2>Problem adding Student</h2>\n". mysql_error(); exit; } Here is the inquire result: Here is the result on student db= , aa ,aa,,2,,,, ,,,,,,, Student added$stdid is the key, it is not returned.
×
×
  • Create New...