Jump to content

robert_gsfame

Members
  • Posts

    876
  • Joined

  • Last visited

Everything posted by robert_gsfame

  1. This might be a stupid simple question, but i need your answer If i execute the UPDATE query but there is no record like what i ask...let say $query="UPDATE $table SET column1='A' WHERE column2='Mine'"; $myquery=mysql_query($query); But let say there is no record like WHERE column2='Mine' Then what will happen, will this cause me an error or not?? thx in advance
  2. thanks Bricktop!!! , how bout the message?? is it possible??
  3. yes, blank screen! i tried my code and it works <?php $query="SELECT DISTINCT owner FROM table'"; $myquery=mysql_query($query); $num=mysql_num_rows($myquery); if(!empty($num)){ while($find=mysql_fetch_assoc($myquery)){ $owner= $find['owner']; echo $owner; echo "<br>"; $query2="SELECT * FROM table WHERE owner='$owner'"; $myquery2=mysql_query($query2); $num2=mysql_num_rows($myquery2); if($num2>1){ while($find2=mysql_fetch_assoc($myquery2)){ $stock=$find2['stock']; echo $stock; echo "<br>";}}else if($num2==1){ $find3=mysql_fetch_array($myquery2); $stock2=$find3['stock']; echo $stock2; } } } how's the code?
  4. I wonder if it's possible to create a link <a href=mailto:blabla@blabla.com>, but once click the subject of the message will be automatically as what i've set using php ... for example: Link ---> once click Subject : Hello world message : <empty>
  5. <?php $query="SELECT * FROM table'"; $myquery=mysql_query($query); $num=mysql_num_rows($myquery); if(!empty($num)){ while($find=mysql_fetch_assoc($myquery)){ $stock = $find['stock']; $owner = $find['owner']; --------------PROBLEM STARTS HERE } I want to have this as result after ECHO Record of stocks of Mr. Barry ---------------------------- Stock B Record of stocks of Mr. James ---------------------------- Stock A Stock C
  6. guys, i got confused with Looping...this is the case I have 3 stocks, let say "Stock A", "Stock B", "Stock C" and the owner of each stock A --> Mr.James stock B --> Mr.Barry Stock C --> Mr. James So A & B belong to Mr. James...and C belong to Mr Barry, now i want to display every stocks that belongs to Mr James and Mr Barry separately How to do it using While?? really confused with this..thx in advance
  7. okay, appreciate your helps!!! THanx so much.. ;D
  8. thx kickstart!!! can you explain the query to me please
  9. Let say i have 100 records and displayed in one page, then i want to get the records from 50-100 and use ORDER BY to re-order whether DESC or ASC How can i do the ORDER BY without re-order first 50 records (0-49)... I've tried LIMIT 49,50 but it still re-order the first 50 records... anyone has a clue?
  10. is this what you mean?? Put the link at the top <a name=top></a> and put this at the bottom of the page<a href=#top>Back to top</a>
  11. <?php if(isset($_POST['submit'])) { $id = $_GET["id"]; $db = mysql_connect("localhost"); mysql_select_db("jobolicious", $db); $quizquery = "UPDATE jobs_uni SET column='$data' WHERE id='$id'"; $result = mysql_query($query) or die(mysql_error()); } ?>
  12. I need someone helps regarding pagination problem...i actually want to make my page limited to let say 50 so it will look like this page1=0-50 page2=51-100 Then i want to sort let say based on the name of a person by giving <a href> and ORDER i can do the sort, but the problem occurs when i want to sort records on page 2, everything got messed up Can anyone help me..below is the code: <?php $var2 =$_GET['title'] ; $var3 =$_GET['field'] ; $var4 =$_GET['country'] ; $orderby = $_GET['orderby']; if(empty($_GET['orderby'])){ $orderby="firstname";} $sort=$_GET['sort']; if(empty($_GET['sort'])){ $sort="DESC";} if($sort=="DESC"){ $sort="ASC";}else if($sort=="ASC"){ $sort="DESC";} $trimmed2 = trim($var2); //trim whitespace from the stored variable $trimmed3 = trim($var3); $trimmed4 = trim($var4); $table = "members"; $field_to_search2 = "title"; $field_to_search3 = "field"; $field_to_search4 = "country"; $query = "SELECT COUNT(*)FROM $table WHERE $field_to_search2 LIKE '%$trimmed2%'AND $field_to_search3 LIKE '%$trimmed3%' AND $field_to_search LIKE '%$trimmed%' AND $field_to_search4 LIKE '%$trimmed4%' ORDER BY $orderby $sort"; $result = mysql_query($query) or trigger_error("SQL", E_USER_ERROR); $r = mysql_fetch_row($result); $numrow = $r[0]; $rowsperpage = 100; $totalpages = ceil($numrow / $rowsperpage); if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) { $currentpage = (int) $_GET['currentpage']; } else { $currentpage = 1; } if ($currentpage > $totalpages) { $currentpage = $totalpages; } if ($currentpage < 1) { $currentpage = 1; } $offset = ($currentpage - 1) * $rowsperpage; $query5 = "SELECT * FROM $table WHERE $field_to_search2 LIKE '%$trimmed2%'AND $field_to_search3 LIKE '%$trimmed3%' AND $field_to_search LIKE '%$trimmed%' AND $field_to_search4 LIKE '%$trimmed4%' AND $field_to_search5 LIKE '%$trimmed5%' ORDER BY $orderby $sort"; $result5 = mysql_query($query5); $count5 = mysql_num_rows($result5); $query = "SELECT * FROM $table WHERE $field_to_search2 LIKE '%$trimmed2%'AND $field_to_search3 LIKE '%$trimmed3%' AND $field_to_search4 LIKE '%$trimmed4%'ORDER BY $orderby $sort LIMIT $offset, $rowsperpage"; $result = mysql_query($query) or trigger_error("SQL", E_USER_ERROR); $count = mysql_num_rows($result); $info = mysql_fetch_array($result); $numresults=mysql_query($query); $numrows=mysql_num_rows($numresults); $mypage=$_SERVER['PHP_SELF']; if ($numrows == 0 ) { echo "<center><font face=arial size=2><p>Search </font>"."<font face=arial size=2> returned zero results</font></p></center>"; } if (empty($s)) { $s=0; } // get results $result = mysql_query($query) or die("Couldn't execute query"); if($numrows > 1 ){$return = "results";} else{ $return = "result"; } echo "<center><table><tr><td><a href=page.php?title=$var2&field=$varx3&q=$var&country=$var4&campus=$var5&orderby=firstname&sort=$sort&search2=Find class=sort>Name</a></td><td width = 70 bgcolor=brown><a href=page.php?title=$var2&field=$var3&country=$var4&orderby=gender&sort=$sort&search2=Find class=sort>gender</a></td></tr></table></center>"; $count = $s + 1 ; while ($r= mysql_fetch_array($result)) { $gender = $r["gender"]; $firstname1 = $r["firstname"]; $field = $r["field"]; $country = $r["country"]; $count++ ; echo "<center><table><tr><td>$firstname</td><td>$gender</td><td>$country</td></tr></table>"; } $range = 5; echo"<center>"; if ($currentpage > 1) { $var2 =$_GET['title'] ; $var3 =$_GET['field'] ; $var4 =$_GET['country'] ; echo " <a href='{$_SERVER['PHP_SELF']}?title=$var2&field=$var3&country=$var4&search2=Find&currentpage=1'><font face=verdana size=2>First</font></a><font face=verdana size=2> |</font>"; $prevpage = $currentpage - 1; echo " <a href='{$_SERVER['PHP_SELF']}?title=$var2&field=$var3&country=$var4&search2=Find&currentpage=$prevpage'><font face=verdana size=2>Previous</font></a><font face=verdana size=2> | </font>"; } for ($x = ($currentpage - $range); $x < ($currentpage + $range); $x++) { if (($x > 0) && ($x <= $totalpages)) { if ($x == $currentpage) { echo "<font face=verdana size=2> [<b>$x</b>] </font>"; } else { echo " <a href='{$_SERVER['PHP_SELF']}?title=$var2&field=$var3&country=$var4&search2=Find+resume&currentpage=$x'><font face=verdana size=2>$x</font></a> "; } } } if ($currentpage < $totalpages) { $nextpage = $currentpage + 1; echo "<font face=verdana size=2>|</font> <a href='{$_SERVER['PHP_SELF']}?title=$var2&field=$var3&country=$var4&search2=Find&currentpage=$nextpage'><font face=verdana size=2>Next</font></a><font face=verdana size=2> | </font>"; echo "<a href='{$_SERVER['PHP_SELF']}?title=$var2&field=$var3&country=$var4search2=Find&currentpage=$totalpages'><font face=verdana size=2>Last</font></a>"; } echo"</center>"; ?> Thanks for any helps
  13. I know this topic is not related to html coding..but hope that any phpfreakers could help me solve this problem! I would like to send some message and it contains <img> Let say <img src="http://www.mydomain.com/helloworld.jpg"/> When i send it via Roundcube webmail to my either yahoo or google account, the image appeared perfectly......But once i tried to send it using HORDE webmail, the image didn't appear! The image only appeared as broken link I tried to view the source, but i found that the code has changed from <img src="http://www.mydomain.com/helloworld.jpg"/> to <img src="cid:pekmp3u42dc@www.mydomain.com"> What should i do, does anyone know what is the problem???
  14. thx cags, it's working now after restarting my computer...i thought some file was missing or crash cause i never get this kind of problem before...thanx a lot!
  15. okay i'll try restarting my computer first...hope it could solve this problem
  16. i can't open the page on both IE 6.0 and FF What is wrong, yesterday was find
  17. i have difficulty in connecting to my localhost/mysite.php It keeps loading, i have been waiting for an ages and it keeps on loading, the page didn't open What is actually the probleM?
  18. Sure you can! Put this beween <head></head> <style type="text/css"> #Div1 { left:431px; top:30px; } </style> <?php echo "<div id='Div1'>Hello world!!</div>";?> Is that what you mean??
  19. I just wonder how to redirect to another page but smoothly...this is like what we always get once post a new thread in the forum. Get into one page stated " thank you for posting" once Post button has been clicked then automatically jump to forum/index.php after let say 3 seconds.
  20. i just wanna ask whether is it possible to change the name of uploaded file, let say user has some file named "myfile1.JPG", and once he upload the file then the name will automatically change to "user1myfile.JPG".. Please give me some clue and code thx in advance
  21. thx for your help anyway....i've checked everything n nothing was missing
  22. yeah it exists..like what i told u before that i've tried myself and no problem at all.. Do u have any clue on this, what can make this happen???
×
×
  • 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.