
conan318
Members-
Posts
195 -
Joined
-
Last visited
Never
Everything posted by conan318
-
just had a thought im using short tags do they work when running a wamp server?
-
still just getting a blank page.. i just tested one of other pages and manged to get an error to throw up the error handling is on. but im still getting a blank a page with no errors. is there something wrong with my query maybe... the database name is main and the table is called users with a username and password field in the table. if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" $_SESSION["myusername"] = $myusername; //copy $myusername to $_SESSION['myusername'] $_SESSION["mypassword"] = $mypassword; //copy $mypassword to $_SESSION['mypassword'] $_SESSION["country"] = $country; $_SESSION["state"] = $state; header("location: login_success.php"); // is the call header meant to be here like this? looks right to me }else { echo "Wrong Username or Password"; }
-
still just getting a blank screen also noticed i had $count=mysql_num_rows($result); <? mysql_connect("localhost", "admin", "admin")or die("cannot connect"); mysql_select_db("main")or die("cannot select DB"); // username and password sent from form $myusername=$_POST['myusername']; $mypassword=md5($_POST["mypassword"]); // To protect MySQL injection (more detail about MySQL injection) $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT username,password FROM main.users WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" $_SESSION["myusername"] = $myusername; //copy $myusername to $_SESSION['myusername'] $_SESSION["mypassword"] = $mypassword; //copy $mypassword to $_SESSION['mypassword'] $_SESSION["country"] = $country; $_SESSION["state"] = $state; } header("location: login_success.php"); else { echo "Wrong Username or Password"; } ?>
-
i believe my error handling is on has been getting errors all night lol how do i check if its on?
-
does not redirected to login_success.php also does not throw up wrong username or password message. gives no errors and all i get is a blank screen on the checklogin.php. is there something im missing? login.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <? session_start(); require "database.php"; ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; " /> <title>Untitled Document</title> <link href="css/main.css" rel="stylesheet" type="text/css" /> </head> <body> <div class="content"> <div class="header"> <img src="banner.png" /> </div> <div class="login"> <form name="form1" method="POST" action="checklogin.php"> Username <input name="myusername" type="text" id="myusername"> <br /> Password <input name="mypassword" type="password" id="mypassword"> <br /> <input type="submit" name="Submit" value="Login"> </form> </div> </div> </body> </html> checklogin.php <? mysql_connect("localhost", "", "")or die("cannot connect"); mysql_select_db("main")or die("cannot select DB"); // username and password sent from form $myusername=$_POST['myusername']; $mypassword=md5($_POST["mypassword"]); // To protect MySQL injection (more detail about MySQL injection) $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT * FROM main.users WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count==mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" $_SESSION["myusername"] = $myusername; //copy $myusername to $_SESSION['myusername'] $_SESSION["mypassword"] = $mypassword; //copy $mypassword to $_SESSION['mypassword'] $_SESSION["country"] = $country; $_SESSION["state"] = $state; header("location: login_success.php"); else { echo "Wrong Username or Password"; } } ?>
-
ahhhh i cant belive i did that again lol thanks
-
will not insert the email into the database plz help everything else inserts fine <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <? session_start(); ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; " /> <title>Sign up now</title> <link href="css/main.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> <!-- function MM_jumpMenu(targ,selObj,restore){ //v3.0 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } //--> </script> </head> <body> <div class="content"> <div class="header"> <img src="banner.png" /> </div> <div class="signup"> <form method="post" action="signup.php" enctype="multipart/form-data"> Sign up and create profile<br /> <br /> <label for="username">Username:</label> <input type="text" name="username" /><br /> <label for="Password">Password:</label> <input type="password" name="password" /><br /> <label for="Confirm Password">Confirm Password:</label> <input type="password" name="confirm_password" /><br /> <label for="email">Email:</label> <input type="text" name="email" /><br /> <label for="age">Age:</label> <input type="text" name="age" /> <br /> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; " /> <title>Untitled Document</title> </head> <?php /* This code will make a connection with database */ mysql_connect("localhost", "admin", "admin")or die("cannot connect"); mysql_select_db("main")or die("cannot select DB"); /* Now we will store the values submitted by form in variable */ $username=$_POST['username']; $pass=$_POST['password']; $email=$_POST['email']; $postcode=$_POST['postcode']; $suburb=$_POST['suburb']; $sex=$_POST['sex']; $city=$_POST['city']; $Country=$_POST['Country']; $age=$_POST['age']; $state=$_POST['state']; /* we are now encrypting password while using md5() function */ $password=md5($pass); $confirm_password=$_POST['confirm_password']; /* Now we will check if username is already in use or not */ $queryuser=mysql_query("SELECT * FROM main.users WHERE username='$username' "); //$result=mysql_query($sql); $checkuser=mysql_num_rows($queryuser); if($checkuser != 0) { echo "Sorry, ".$username." is already been taken."; } else { /* Now we will check if email is already in use or not */ $queryuser=mysql_query("SELECT * FROM main.users WHERE email='$email' "); //$result=mysql_query($sql); $checkuser=mysql_num_rows($queryuser); if($checkuser != 0) { echo "Sorry, ".$email." has already been taken."; } else { /* now we will check if password and confirm password matched */ if($pass != $confirm_password) { echo "Password and confirm password fields were not matched"; } else { if($age < "18") { echo "you must be 18 years or older to join"; } else { if($email = "") { echo "you must enter an email address"; } else { if($postcode == "") { echo "you must your postcode"; } else { if($city == "") { echo "you must enter your city"; } else { if($suburb == "") { echo "you must enter your suburb"; } else { if($state == "") { echo "you must enter your state"; } else { /* Now we will write a query to insert user details into database */ $insert_user=mysql_query("INSERT INTO main.users (state, age, city, country, username, password, email, postcode, suburb, sex) VALUES ('$state','$age', '$city', '$Country' , '$username', '$password', '$email', '$postcode', '$suburb', '$sex')") ; } if($insert_user) { header("location:signupnow.php"); die();} else { echo "error in registration".mysql_error(); } /* closing the if else statements */ }}}}}}}} ?> <body> </body> </html>
-
it all working expect for its not inserting email value into the database for some silly reason. i have it set up a varchar and latin1_swedish_ci not sure if that's right tho it just defaulted to that setting
-
$insert_user=mysql_query("INSERT INTO main.users (state, age, city, country, username, password, email, postcode, suburb, sex) VALUES ('$state','$age', '$city', '$Country' , '$username', '$password', '$email', '$postcode', '$suburb', '$sex')") ; fixed cheers mate
-
it seems to be working but now the email check is saying that the email address is taken no matter what i put in. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; " /> <title>Untitled Document</title> </head> <?php /* This code will make a connection with database */ mysql_connect("localhost", "admin", "admin")or die("cannot connect"); mysql_select_db("main")or die("cannot select DB"); /* Now we will store the values submitted by form in variable */ $username=$_POST['username']; $pass=$_POST['password']; $email=$_POST['email']; $postcode=$_POST['postcode']; $suburb=$_POST['suburb']; $sex=$_POST['sex']; $city=$_POST['city']; $Country=$_POST['Country']; $age=$_POST['age']; $state=$_POST['state']; /* we are now encrypting password while using md5() function */ $password=md5($pass); $confirm_password=$_POST['confirm_password']; /* Now we will check if username is already in use or not */ $queryuser=mysql_query("SELECT * FROM main.users WHERE username='$username' "); //$result=mysql_query($sql); $checkuser=mysql_num_rows($queryuser); if($checkuser != 0) { echo "Sorry, ".$username." is already been taken."; } else { /* Now we will check if username is already in use or not */ $queryuser=mysql_query("SELECT * FROM main.users WHERE email='$email' "); //$result=mysql_query($sql); $checkuser=mysql_num_rows($queryuser); if($checkuser != 0) { echo "Sorry, ".$email." has already been taken."; } else { /* now we will check if password and confirm password matched */ if($pass != $confirm_password) { echo "Password and confirm password fields were not matched"; } else { if($age < "18") { echo "you must be 18 years or older to join"; } else { if($email = "") { echo "you must enter an email address"; } else { if($postcode == "") { echo "you must your postcode"; } else { if($city == "") { echo "you must enter your city"; } else { if($suburb == "") { echo "you must enter your suburb"; } else { if($state == "") { echo "you must enter your state"; } else { /* Now we will write a query to insert user details into database */ $insert_user=mysql_query("INSERT INTO main.users state, age, city, country, username, password, email, postcode, suburb, sex) VALUES ('$state','$age', '$city', '$Country' , '$username', '$password', '$email', '$postcode', '$suburb', '$sex'") ; if($insert_user) { header("location:signupnow.php"); die();} else { echo "error in registration".mysql_error(); } /* closing the if else statements */ }}}}}}}}} ?> <body> </body> </html>
-
check the manual that corresponds to your MySQL server version for the right syntax to use near i have set up wamp server Server: localhost (localhost via TCP/IP) Server version: 5.5.8-log Protocol version: 10 MySQL charset: UTF-8 Unicode (utf8) the code works on online but when using the wamp server i get this error error in registration 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 ') VALUES ('QLD','18', 'test', 'Australia' , 'test', '098f6bcd4621d373cade4e83262' at line 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; " /> <title>Untitled Document</title> </head> <?php /* This code will make a connection with database */ mysql_connect("localhost", "", "")or die("cannot connect"); mysql_select_db("main")or die("cannot select DB"); /* Now we will store the values submitted by form in variable */ $username=$_POST['username']; $pass=$_POST['password']; $email=$_POST['email']; $postcode=$_POST['postcode']; $suburb=$_POST['suburb']; $sex=$_POST['sex']; $city=$_POST['city']; $Country=$_POST['Country']; $age=$_POST['age']; $state=$_POST['state']; /* we are now encrypting password while using md5() function */ $password=md5($pass); $confirm_password=$_POST['confirm_password']; /* Now we will check if username is already in use or not */ $queryuser=mysql_query("SELECT * FROM users WHERE username='$username' "); //$result=mysql_query($sql); $checkuser=mysql_num_rows($queryuser); if($checkuser != 0) { echo "Sorry, ".$username." is already been taken."; } else { /* Now we will check if username is already in use or not */ $queryuser=mysql_query("SELECT * FROM users WHERE email='$email' "); //$result=mysql_query($sql); $checkuser=mysql_num_rows($queryuser); if($checkuser != 0) { echo "Sorry, ".$email." has already been taken."; } else { /* now we will check if password and confirm password matched */ if($pass != $confirm_password) { echo "Password and confirm password fields were not matched"; } else { if($age < "18") { echo "you must be 18 years or older to join"; } else { if($email = "") { echo "you must enter an email address"; } else { if($postcode == "") { echo "you must your postcode"; } else { if($city == "") { echo "you must enter your city"; } else { if($suburb == "") { echo "you must enter your suburb"; } else { if($state == "") { echo "you must enter your state"; } else { /* Now we will write a query to insert user details into database */ $insert_user=mysql_query("INSERT INTO users (state, age, city, Country, username, password, email, postcode, suburb, sex,) VALUES ('$state','$age', '$city', '$Country' , '$username', '$password', '$email', '$postcode', '$suburb', '$sex') "); if($insert_user) { header("location:signupnow.php"); die();} else { { echo "error in registration".mysql_error(); } } /* closing the if else statements */ }}}}}}}}} ?> <body> </body> </html>
-
this is the test.js file which goes with the code i gave you before. test.js CArray= new Array(); IArray= new Array(); IMGArray= new Array(); PArray= new Array(); CArray[0] = "999"; CArray[1] = "998"; CArray[2] = "997"; CArray[3] = "996"; CArray[4] = "995"; CArray[5] = "994"; CArray[6] = "993"; CArray[7] = "992"; CArray[8] = "991"; CArray[9] = "990"; IArray[0] = "Baby Nappy Cake"; IArray[1] = "Blue Baby Nappy Cake"; IArray[2] = "Canebasket - Include's Champagne and Teddy Bear"; IArray[3] = "Beautiful Gift Hamper"; IArray[4] = "Gift Hamper Wrapped in Celafain "; IArray[5] = "Wine Gift Hamper"; IArray[6] = "Mothers' Day Gift Hamper"; IArray[7] = "Champagne Cocktail"; IArray[8] = "Golf and Wine Appreciation"; IArray[9] = "Sweet Valentine"; IMGArray[0] = "bear1.png"; IMGArray[1] = "bear3.jpg"; IMGArray[2] = "bear4.jpg"; IMGArray[3] = "bear5.jpg"; IMGArray[4] = "bear6.jpg"; IMGArray[5] = "bear7.jpg"; IMGArray[6] = "bear8.jpg"; IMGArray[7] = "bear9.jpg"; IMGArray[8] = "bear10.jpg"; IMGArray[9] = "bear11.jpg"; PArray[0] = "40.00"; PArray[1] = "25.00"; PArray[2] = "28.00"; PArray[3] = "35.00"; PArray[4] = "44.00"; PArray[5] = "23.00"; PArray[6] = "34.00"; PArray[7] = "39.00"; PArray[8] = "49.00"; PArray[9] = "59.00"; var MaxItems = 9; function cal(frm) { var T = 0; var i = 0; var cal = 0; while (i <= MaxItems) { cal = ((PArray[i] * frm.elements[i].value) ); T += cal; if( isNaN(cal) ) alert("you have not enterd a valid QTY please try again "); i = i+1; } frm.result.value = T; } for (i = 0; i <= MaxItems; i++) { document.write("<tr align=center><td>" + CArray[i] + "</td>") document.write("<td><img src = '" + IMGArray[i] + "'height='50' width='50' border='0'/></td>") document.write("<td>" + IArray[i] + "</td>") document.write("<td>$" + PArray[i] + "</td>") document.write("<td><input type='text' size='5' maxlength='2'/></td></tr>"); }
-
<html xmlns="http://www.w3.org/1999/xhtml"> ok i have a simple form which works up into the redirect intead of taking me to checkout.html its putting the result of the calculation url like this. www.billysgiftbox/index.html?result=59 <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Billy's Gift Baskets</title> <link href="main.css" rel="stylesheet" type="text/css"> <script type="text/javascript"> <!-- if (document.images) { pic1= new Image(); pic1.src="logo.png"; pic2= new Image(); pic2.src="logo2.png"; } </script> <SCRIPT language="JavaScript"> function checkout() { if (result.value==='0'){ alert('Please select an item to purchase') } else if (result.value==='NaN'){ alert('Sorry there was an error please try again') } else if (result.value!='0') { check() } } </SCRIPT> <SCRIPT language="JavaScript"> function check() { var x=window.confirm("Are you sure you want to check out?") if (x) window.location.href="checkout.html"; else window.location="index.html"; } </SCRIPT> </head> <body> <div class="banner"> <img src="logo.png" name="pic1" border="0" id="pic1" onmouseover="document.pic1.src='logo2.png'" onmouseout="document.pic1.src='logo.png'"> </div> <div class="content"> <div class="table"> <form action="" name="form1" id="form1" onsubmit"checkout()" > <table border="5" > <tr> <td>Code</td> <td>Image</td> <td>Item</td> <td>Price</td> <td>Qty</td> </tr> <script type="text/javascript" src="test2.js"></script> <tr> <td colspan=0><input type="button" value="Buynow" onClick="cal(this.form)"> <input type="reset" value="Clear"/></td> <td>Total:</td> <td align="center">$ <input type="text" name="result" id="result" value="0" size=10 onClick="alert('Sorry you cant change the total price ')"></td> <td colspan=1> <input type="submit" Value="Checkout" /></td> </tr> </table> </form> </div> </div> </body> </html>
-
hi i just making a simple form and trying to get the email to validate with no luck can someone tell me what im doing wrong thanks <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Billy's gift baskets</title> <link href="main.css" rel="stylesheet" type="text/css"> <script type="text/javascript"> <!-- if (document.images) { pic1= new Image(); pic1.src="logo.png"; pic2= new Image(); pic2.src="logo2.png"; } </script> <SCRIPT language="JavaScript"> function check() { if (n.value==""){ alert('please enter your name') } if(c.value==''){ alert('please enter your credit card number') } if(cv.value==''){ alert('please enter your cvc number') } if (e.value==""){ alert(' We need your email details') } function validateForm() { var x=document.forms["form1"]["e"].value var atpos=x.indexOf("@"); var dotpos=x.lastIndexOf("."); if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length) { alert("Not a valid e-mail address"); return false; } else { window.confirm('Press ok to Comfirm purchase') window.location="index.html"; }}} </script> </head> <body> <div class="banner"> <img src="logo.png" name="pic1" border="0" id"pic1" onmouseover="document.pic1.src='logo2.png'" onmouseout="document.pic1.src='logo.png'"> </div> <form name="form1"> <table> <tr> <td>Name</td> <td><input type="text" size"20" name="n" id="n" maxlength="20" value=""/></td> </tr> <tr> <td> Credit card</td> <td><input type="text" name="c" id="c" size"20" maxlength="20"/></td> </tr> <tr> <td> CVC</td> <td><input type"text" name="cv" id="cv" size"3" maxlength="3" /></td> </tr> <tr> <td>email</td> <td><input type"text" size "30" name="e" id="e" maxlength="30" /></td> </tr> <tr> <td>Feedback</td> <td><input type="text" size"50" maxlength="50" /></td> </tr> <tr> <td>Submit</td> <td><input type="button" Value="Submit" onclick="check()"></td> </tr> </table> </form> </body> </html>
-
java script to open a flash banner in a new window
conan318 replied to conan318's topic in Javascript Help
not sure i havent worked with flash banners before my mate has just rang me and asked so ive had a look but i got no idea -
java script to open a flash banner in a new window
conan318 replied to conan318's topic in Javascript Help
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" Codebase="http://download.macromedia.Com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" Width="125" height="125"> <param name=movie Value="http://images.website.ws/images/English/banners/kvmlm2/125x125_05.swf?usetop=1&link1=http%3A%2F%2Fwebsite%2Ews%2Fkvmlm2%2Fmy%2Edhtml%3Fsponsor%3Drayaus65"> <param name=quality value=high> <param name="allowScriptAccess" value="always"> <embed src="http://images.website.ws/images/English/banners/kvmlm2/125x125_05.swf?usetop=1&link1=http%3A%2F%2Fwebsite%2Ews%2Fkvmlm2%2Fmy%2Edhtml%3Fsponsor%3Drayaus65" Type="application/x-shockwave-flash" quality="high" Width="125" height="125" AllowScriptAccess="always" Pluginspage="http://WWW.macromedia.Com/go/getflashplayer" > </embed> </object> -
do i need to use java script to open a flash banner in a new window... or is there an eazyer way to this.
-
thanks guys that helps me understand how it works i am going to try and write something simple and see if i can get it to work will let you know how i go.
-
so hows does placesy like yellowpages.com.au do it surely they don't make a page for every listing
-
I am planning to make a business index. i am wondering if anyone knows if google will craw your data base and index them? thanks
-
thanks.. i know i should try first i wrote that line down but i knew it was missing something
-
hi i am about to start building a small search where users type in what they are searching for but i am wanting to also find similar things to what they have typed in. $data = mysql_query("SELECT * FROM users WHERE users.bizname='%$bizname%' "); would i use something like that.. i haven't tried yet. thought id ask first
-
set a variable depending on the out of the query.
conan318 replied to conan318's topic in PHP Coding Help
ive been mucking around with it and still havent been able to crack it. now when i submit the form it returns no data. $getuname = mysql_result( $data, 0 ); it threw up an error cant find row 0. so heres a larger snippit of my code. $Country=$_GET['Country']; $state=$_GET['state']; $city=$_GET['city']; if((trim($Country) !== ''&&($state) !== ''&&($city) !== '')){ $data = mysql_query("SELECT * FROM users WHERE users.state='$state' AND users.country='$Country' AND users.city='$city' ORDER BY RAND() DESC LIMIT 1 "); $info = mysql_fetch_array($data); $getuname = $result['username']; } elseif((trim($country) !== ''&&($state) == ''&&($city) == '')){ $data = mysql_query("SELECT * FROM users WHERE users.country='$country'ORDER BY RAND() DESC LIMIT 1 "); $info = mysql_fetch_array($data); $getuname = $result['username']; } elseif((trim($Country) == ''&&($state) !== ''&&($city) == '')){ $data = mysql_query("SELECT * FROM users WHERE users.state='$state'ORDER BY RAND() DESC LIMIT 1 "); $info = mysql_fetch_array($data); $getuname = $result['username']; } elseif((trim($country) !== ''&&($state) !== ''&&($city) == '')){ $data = mysql_query("SELECT * FROM users WHERE users.state='$state' AND users.country='$Country'ORDER BY RAND() DESC LIMIT 1 "); $info = mysql_fetch_array($data); $getuname = $result['username']; } elseif((trim($Country) !== ''&&($state) == ''&&($city) !== '')){ $data = mysql_query("SELECT * FROM users WHERE users.country='$Country' AND users.city='$city'ORDER BY RAND() DESC LIMIT 1 "); $info = mysql_fetch_array($data); $getuname = $result['username']; } elseif((trim($Country) == ''&&($state) !== ''&&($city) !== '')){ $data = mysql_query("SELECT * FROM users WHERE users.state='$state' AND users.city='$city' ORDER BY RAND() DESC LIMIT 1"); $info = mysql_fetch_array($data); $getuname = $info['username']; } $queryuser=mysql_query("SELECT * FROM freinds WHERE freind='$myusername' AND username='$getuname' OR freind='$getuname' AND username='$myusername'"); //$result=mysql_query($sql); $checkuser=mysql_num_rows($queryuser); if($checkuser != 0){ while($result = mysql_fetch_array( $data )){ Echo $getuname; echo $myusername; Echo'<div class="profile">'; Echo'<div class="pframe">'; Echo '<a href="new_message.php?username=' . "$getuname" . '">send message</a>'."<br/>"; Echo '<div class="pprofile">'; Echo "<img src='http://datenight.netne.net/images/".$info['img'] ."' width='300' height='300''> <br>"; Echo '<div class="pname">'; Echo "<b>Name:</b> ".$info['username'] . ": "; Echo "<b>Sex:</b> ".$info['sex'] . ": "; Echo "<b>age:</b> ".$info['age'] . ": "." <br>"; Echo '</div>'; Echo '<div class="plocation">'; Echo "<b>country:</b> ".$info['country'] . ": "."<br/>"; Echo "<b>city:</b> ".$info['city'] . ": "."<br/>"; Echo "<b>Suburb:</b> ".$info['suburb'] . ": "."<br/>"; Echo "<b>Sate:</b> ".$info['state'] . ": "." <br/>"; Echo '</div>'; Echo '<div class="pintrested">'; Echo "<b>Intrested in</b>" . ": "."<br/>"; Echo "".$info['rel'] . ": "."<br/>"; Echo "".$info['frwb'] . ": "."<br/>"; Echo "".$info['ons'] . ": "."<br>"; Echo "".$info['fr'] . "<br>"; Echo '</div>'; Echo '<div class="paboutme">'; Echo "<b>About me:</b> ".$info['aboutme'] . "<br> "; Echo '</div>'; Echo '<div class="plooking">'; Echo "<b>Looking for:</b> ".$info['looking'] . " <br>"; } ?> <form method="GET" action="<?php echo $_SERVER['PHP_SELF'];?>" name="searchForm"> <label>Select Country</label> <select name="Country"> <option value="Australia">Australia</option> <option value="USA">USA</option> <option value="Canada">Canada</option> <option value="England">England</option> <option value="New Zealand">New Zealand</option> </select><br /> <label>Select State</label> <select name="state"> <optgroup label="Australia"> <option value="QLD">QLD</option> <option value="NSW">NSW</option> <option value="ACT">ACT</option> <option value="VIC">VIC</option> <option value="TAZ">TAZ</option> <option value="SA">SA</option> <option value="WA">WA</option> <option value="NT">NT</option> </optgroup> </form> <? Echo '</div>'; } else { if((trim($Country) !== ''&&($state) !== ''&&($city) !== '')){ $data = mysql_query("SELECT * FROM users WHERE users.state='$state' AND users.country='$Country' AND users.city='$city' ORDER BY RAND() DESC LIMIT 1 "); $info = mysql_fetch_array($data); $getuname = $result['username']; } elseif((trim($Country) !== ''&&($state) == ''&&($city) == '')){ $data = mysql_query("SELECT * FROM users WHERE users.country='$Country'ORDER BY RAND() DESC LIMIT 1 "); $info = mysql_fetch_array($data); $getuname = $result['username']; } elseif((trim($country) == ''&&($state) !== ''&&($city) == '')){ $data = mysql_query("SELECT * FROM users WHERE users.state='$state'ORDER BY RAND() DESC LIMIT 1 "); $info = mysql_fetch_array($data); $getuname = $result['username']; } elseif((trim($Country) !== ''&&($state) !== ''&&($city) == '')){ $data = mysql_query("SELECT * FROM users WHERE users.state='$state' AND users.country='$country'ORDER BY RAND() DESC LIMIT 1 "); $info = mysql_fetch_array($data); $getuname = $result['username']; } elseif((trim($Country) !== ''&&($state) == ''&&($city) !== '')){ $data = mysql_query("SELECT * FROM users WHERE users.country='$country' AND users.city='$city'ORDER BY RAND() DESC LIMIT 1 "); $info = mysql_fetch_array($data); $getuname = $result['username']; } elseif((trim($Country) == ''&&($state) !== ''&&($city) !== '')){ $data = mysql_query("SELECT * FROM users WHERE users.state='$state' AND users.city='$city' ORDER BY RAND() DESC LIMIT 1"); $info = mysql_fetch_array($data); $getuname = $info['username']; } while($info = mysql_fetch_array( $data )){ Echo'<div class="profile">'; Echo'<div class="pframe">'; Echo '<a href="freinds.php?username=' . "$getuname" . '">Contact request</a>'."<br/>"; Echo '<div class="pprofile">'; Echo "<img src='http://datenight.netne.net/images/".$info['img'] ."' width='300' height='300''> <br>"; Echo '<div class="pname">'; Echo "<b>Name:</b> ".$info['username'] . ": "; Echo "<b>Sex:</b> ".$info['sex'] . ": "; Echo "<b>age:</b> ".$info['age'] . ": "." <br>"; Echo '</div>'; Echo '<div class="plocation">'; Echo "<b>country:</b> ".$info['country'] . ": "."<br/>"; Echo "<b>city:</b> ".$info['city'] . ": "."<br/>"; Echo "<b>Suburb:</b> ".$info['suburb'] . ": "."<br/>"; Echo "<b>Sate:</b> ".$info['state'] . ": "." <br/>"; Echo '</div>'; Echo '<div class="pintrested">'; Echo "<b>Intrested in</b>" . ": "."<br/>"; Echo "".$info['rel'] . ": "."<br/>"; Echo "".$info['frwb'] . ": "."<br/>"; Echo "".$info['ons'] . ": "."<br>"; Echo "".$info['fr'] . "<br>"; Echo '</div>'; Echo '<div class="paboutme">'; Echo "<b>About me:</b> ".$info['aboutme'] . "<br> "; Echo '</div>'; Echo '<div class="plooking">'; Echo "<b>Looking for:</b> ".$info['looking'] . " <br>"; } ?> <form method="GET" action="<?php echo $_SERVER['PHP_SELF'];?>" name="searchForm"> <label>Select Country</label> <select name="Country"> <option value="Australia">Australia</option> <option value="USA">USA</option> <option value="Canada">Canada</option> <option value="England">England</option> <option value="New Zealand">New Zealand</option> </select><br /> <label>Select State</label> <select name="state"> <optgroup label="Australia"> <option value="QLD">QLD</option> <option value="NSW">NSW</option> <option value="ACT">ACT</option> <option value="VIC">VIC</option> <option value="TAZ">TAZ</option> <option value="SA">SA</option> <option value="WA">WA</option> <option value="NT">NT</option> </optgroup> </form> <input type="submit" value="submit" /> </form> <? Echo '</div>'; } ?> -
set a variable depending on the out of the query.
conan318 replied to conan318's topic in PHP Coding Help
the idea of order by random is just so it displays a differnt record everytime im not 2 concerned on how random it is