Jump to content

alienmojo

Members
  • Posts

    46
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

alienmojo's Achievements

Member

Member (2/5)

0

Reputation

  1. well im thinking that i dont have permission to do access the database because my connect is working (im not connecting as user and im not sure why its saying that) but anyway i have if statement testing the connection on the mysql-connect and mysql_select_db it its having a problem with the mysql_select_db
  2. im trying to connect to a database and i am getting this Access denied for user ''@'localhost' to database 'realestate'
  3. $con = mysql_connect("localhost","marquis","******"); instead of useing local host when the website is being hosted by another other server do you put the url address if not what do you put
  4. instead of casting it as unsigned can i put int or decimal
  5. $con = mysql_connect("localhost","root","******"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("realestate", $con); $table=$_POST[username]; $result = mysql_query("SELECT * FROM $table"); echo "<table border='5'> <tr> <th>Picture</th> <th>Address</th> <th>Price</th> <th>Baths</th> <th>Bedrooms</th> <th>State</th> <th>City</th> <th>Square Feet</th> </tr>"; while($row = mysql_fetch_array($result)) $ac=$row['fav']; { $result1 = mysql_query("SELECT * FROM estate WHERE accountnum=$ac"); while($row = mysql_fetch_array($result1)) { $accountnum=$row['accountnum']; echo "<tr>"; echo '<td><a href="descrip.php?accountnum='.$accountnum.'"> <img src="images/'.$row['imagename'].'" width="75" height="75"></a> </td>'; echo "<td>" . $row['address'] . "</td>"; echo "<td>" . $row['price'] . "</td>"; echo "<td>" . $row['baths'] . "</td>"; echo "<td>" . $row['bedrooms'] . "</td>"; echo "<td>" . $row['state'] . "</td>"; echo "<td>" . $row['city'] . "</td>"; echo "<td>" . $row['squarefeet'] . "</td>"; echo "</tr>"; } } if(mysql_num_rows($result1) == 0) ECHO "<h3>YOU HAVE SAVED NO FAVORITES!</h3>"; mysql_close($con); what im doing is writing a php script that displays a members fav houses i did this by when the user finds a house he likes it stores the account number in "there" table this is sopost to run through all of the account number store in the members table and then referance that number to account number in another table and output the matches in a table. it works fine except instead outputing all of the house it only outputs the house entered last. any question just ask
  6. sorry this is a little hard to put into words i will just show you the output PRICE 2 250000 250000 250000 7000000 80000 8000000 90000 basicly its just looking at the first digit from the left and sorting them that way
  7. no i only want it to sort by price but say for instance there is a price of 9 and a price of 80 its saying that the 9 is bigger the only thing i can thing of that can cause this maybe is the fact that they are being read in as strings instead of ints
  8. ok thanks that worked! it there a way to make it to where it it sorts by more that just the first number EX. its saying 9 > 80
  9. this is my first time to use the order by thing in php when i run the script it sayed that it failed here is the quiery im passing in SELECT * FROM estate WHERE price BETWEEN 0 AND 99999999999999 AND baths BETWEEN 0 AND 99999999999999 AND bedrooms BETWEEN 0 AND 99999999999999 AND ORDER BY price
  10. i have a php script that displays results in a table after the user gives certain criteria. i want to be able to sort the results buy clicking the table header EX.price and it refreshes itself with the rows sorted. I have all of that done except after you click on the header i get an error saying my quiery fail. This is because when it refreshes itself it does not retain the criteria sent by the form the user filled out to build the quiery. here is my code if u need futher explimation or have any question let me know <html> <head> <link rel="stylesheet" href="CSS.css" type="text/css" /> <title>Search Results</title> </head> <body align="center"> <div id="sidebar"> <img src="images/bigdoglogo.gif" width="225"height="79" border="0"><div id="menu"> <a href="Home.html">Home</a> <a href="AboutUs.html">About Us</a> <a href="CMS.php">Realtor login</a> <a href="newmembers.html">Member Signup</a> <a href="memberlogin.html">Member's Login</a> <a href="morgage.html">Mortgage Info</a> <a href="contact.html">Contact Us</a></div> </div> </div> <div id="content"> </body> <h1>Search Results</h1><br><br> <?php $sort=$_GET['sort']; $SQL = "SELECT * FROM estate "; $SQLTEST = "SELECT * FROM estate "; if($_GET["city"]) { $city=$_GET["city"]; $SQL =" $SQL WHERE city='".$city."' "; } if($_GET["state"]) { if($SQL != $SQLTEST) { $state=$_GET["state"]; $SQL =" $SQL AND state='".$state."' "; } else { $state=$_GET["state"]; $SQL =" $SQL WHERE state='".$state."' "; } } if($_GET["zipcode"]) { if($SQL!=$SQLTEST) { $zipcode=$_GET["zipcode"]; $SQL =" $SQL AND zipcode='".$zipcode."' "; } else { $zipcode=$_GET["zipcode"]; $SQL =" $SQL WHERE zipcode='".$zipcode."' "; } } $pricemin=$_GET["pricemin"]; $pricemax=$_GET["pricemax"]; if($pricemax=="1") $pricemax="99999999999999"; if($_GET["pricemin"]||$pricemax) { if($SQL!=$SQLTEST) { $SQL =" $SQL AND price BETWEEN ".$pricemin." AND ".$pricemax." "; } else { $SQL =" $SQL WHERE price BETWEEN ".$pricemin." AND ".$pricemax." "; } } //100 $bathsmin=$_GET["bathsmin"]; $bathsmax=$_GET["bathsmax"]; if($bathsmax="1") $bathsmax="99999999999999"; if($_GET["bathsmin"]||$bathsmax) { if($SQL!=$SQLTEST) { $SQL =" $SQL AND baths BETWEEN ".$bathsmin." AND ".$bathsmax." "; } else { $SQL =" $SQL WHERE baths BETWEEN ".$bathsmin." AND ".$bathsmax." "; } } $bedroomsmin=$_GET["bedroomsmin"]; $bedroomsmax=$_GET["bedroomsmax"]; if($bedroomsmax="1") $bedroomsmax="99999999999999"; if($_GET["bedroomsmin"]||$bedroomsmax) { if($SQL!=$SQLTEST) { $SQL =" $SQL AND bedrooms BETWEEN ".$bedroomsmin." AND ".$bedroomsmax." "; } else { $SQL =" $SQL WHERE bedrooms BETWEEN ".$bedroomsmin." AND ".$bedroomsmax." "; } } if($_GET["county"]) { if($SQL!=$SQLTEST) { $county=$_GET["county"]; $SQL =" $SQL AND county='".$county."' "; } else { $county=$_GET["county"]; $SQL =" $SQL WHERE county='".$county."' "; } } if($_GET["buyorlease"]) { if($SQL!=$SQLTEST) { $buyorlease=$_GET["buyorlease"]; $SQL =" $SQL AND buyorlease='".$buyorlease."' "; } else { $buyorlease=$_GET["buyorlease"]; $SQL =" $SQL WHERE buyorlease='".$buyorlease."' "; } } if($_GET["typeofprop"]) { if($SQL!=$SQLTEST) { $typeofprop=$_GET["typeofprop"]; $SQL =" $SQL AND typeofprop='".$typeofprop."' "; } else { $typeofprop=$_GET["typeofprop"]; $SQL =" $SQL WHERE typeofprop='".$typeofprop."' "; } } if($sort==1) $SQL =" $SQL AND ORDER BY price "; if($sort==2) $SQL =" $SQL AND ORDER BY baths "; if($sort==3) $SQL =" $SQL AND ORDER BY bedrooms "; if($sort==4) $SQL =" $SQL AND ORDER BY squarefeet "; $con = mysql_connect("localhost","root","******"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("realestate", $con); $result = mysql_query($SQL); echo $SQL1; echo "<table border='5'> <tr> <th>Picture</th> <th><a href=\"results.php?sort=1\">Price</a></th> <th><a href=\"results.php?sort=2\">Baths</a></th> <th><a href=\"results.php?sort=3\">Bedrooms</a></th> <th>State</th> <th>City</th> <th><a href=\"results.php?sort=4\">Square Feet</a></th> </tr>"; while($row = mysql_fetch_array($result)) { $accountnum=$row['accountnum']; echo "<tr>"; echo '<td><a href="descrip.php?accountnum='.$accountnum.'"> <img src="images/'.$row['imagename'].'" width="75" height="75"></a> </td>'; echo "<td>" . $row['price'] . "</td>"; echo "<td>" . $row['baths'] . "</td>"; echo "<td>" . $row['bedrooms'] . "</td>"; echo "<td>" . $row['state'] . "</td>"; echo "<td>" . $row['city'] . "</td>"; echo "<td>" . $row['squarefeet'] . "</td>"; echo "</tr>"; } echo "</table>"; if(mysql_num_rows($result) == 0) ECHO "<h3>NO MATCHES FOUND</h3>"; mysql_close($con); ?> </body> </html>
  11. echo "<table border='5'> <tr> <th>Picture</th> <th><a href="results.php?sort=1">Price</a></th> <th><a href="results.php?sort=2">Baths</a></th> <th><a href="results.php?sort=3">Bedrooms</a></th> <th>State</th> <th>City</th> <th><a href="results.php?sort=4">Square Feet</a></th> </tr>"; theres my code thats the part getting this error
  12. alienmojo

    sha1

    ok im trying to add sha1 hashing into my website i have this code in a scrip that add users to my website and then hashs there password $password=sha1($_POST[password]); $sql="INSERT INTO users (login, pass) VALUES ('$_POST[username]','$password')"; and say for instance you put "cool" there it puts this in the database 85d8d76ba15bde3ef160 here is the code i have in i have in the login script once you add the user $pass=htmlentities(sha1($_POST["pass"]), ENT_QUOTES); and it hashes it to this 85d8d76ba15bde3ef1602f477f32fd64e32fea5a after coping and pasting this in here i realized the problem was when i fist made the table (not knowing that i was going to use sha1) made my pass equal to varchar(20) is there a way to change it to where pass is equal to varchar(255) without loosing all of my data in the collum
  13. ok im finally adding sha1 into my website what i cant figure out how to do is get the password already stored in the database hashed into the sha1 format
  14. alienmojo

    search

    can any one recomend a good php script that free and goes through your entire web site and searches for the words you entered
  15. <html> <head> <title>Description</title> <link rel="stylesheet" href="CSS.css" type="text/css" /> </head> <body> <div id="sidebar"> <img src="images/bigdoglogo.gif" width="225"height="79" border="0"><div id="menu"> <a href="Home.html">Home</a> <a href="AboutUs.html">About Us</a> <a href="CMS.php">Realtor login</a> </div> </div> <div id="content"> <h1>Description</h1> <br> <br> <?php $accountnum=$_GET["accountnum"]; $con = mysql_connect("localhost","root","******"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("realestate", $con); $result = mysql_query("SELECT * FROM estate WHERE accountnum='$accountnum'"); while($row = mysql_fetch_array($result)) { $accountnum=$row['accountnum']; echo '<center>'; echo '<img src="images/'. $row['imagename'] .'" width="400"height="400">'; echo '</center>'; echo '<br>'; echo '<br>'; echo "<table border='5'bgcolor='#ff8080'> <tr> <th>Address</th> <th>Price</th> <th>Baths</th> <th>Bedrooms</th> <th>State</th> <th>City</th> <th>Square Feet</th> <th>County</th> <th>Year Built</th> <th>Buy or Lease</th> </tr>"; echo "<tr>"; echo "<td>" . $row['address'] . "</td>"; echo "<td>" . $row['price'] . "</td>"; echo "<td>" . $row['baths'] . "</td>"; echo "<td>" . $row['bedrooms'] . "</td>"; echo "<td>" . $row['state'] . "</td>"; echo "<td>" . $row['city'] . "</td>"; echo "<td>" . $row['squarefeet'] . "</td>"; echo "<td>" . $row['county'] . "</td>"; echo "<td>" . $row['yearbuilt'] . "</td>"; echo "<td>" . $row['buyorlease'] . "</td>"; echo "</tr>"; echo "</table>"; echo "<br>"; echo "<br>"; echo "<center>"; echo "<h4>"; echo $row['description']; echo "<h4/>"; echo "<center/>"; } mysql_close($con); $accountnum=$_GET[accountnum] echo '<a href="property.html?accountnum='.$accountnum.'">Click here add house to your favorites</a>'; ?> </body> </html>
×
×
  • 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.