Jump to content

taith

Members
  • Posts

    1,514
  • Joined

  • Last visited

Everything posted by taith

  1. no clue what your trying to do here... but you always want to protect variables before they go into a database... <body> <h2 align="center">Student Entry</h2> <form action="test_insertion.php" method="post"> <table border="2" align="center"> <tr> <td>Roll No :</td> <td><input type="text" name="rn" /></td> </tr> <tr> <td>Student Name :</td> <td><input type="text" name="sn" /></td> </tr> </table> <center> <input type="submit" value="Submit" /> </center> </form> </body> <body><?php $rn=addslashes(strip_tags($_POST['rn'])); $sn=addslashes(strip_tags($_POST['sn'])); echo $rn.$sn; $conn=mysql_connect("localhost","sec","sec"); $db=mysql_select_db("mysql",$conn); $query=mysql_query("insert into std (rollno , name) values ($rn , $sn)"); while($res=mysql_fetch_row($query)) echo $res[0] ." " .$res[1]; ?></body>
  2. taith

    Loop

    um... what type of loop? what are you expecting to get out? what do you have going in?
  3. that there is not a popup... or atleast from the code you gave.
  4. hows this for an example... assume $row[numbers]='|1|2|4|6|7|'; $numbers=explode("|",$row[numbers]); $i=0; foreach($numbers as $val){ $out.='<a>'.$val.'</a>'; } echo $out; then when you delete an image, just query for fields... $query=mysql_query("SELECT * FROM `` WHERE `numbers`='%|$num|%'"); while($row=mysql_fetch_assoc($query)){ $row[numbers]=explode("|",$row[numbers]); unset($row[numbers][array_search($num, $row[numbers])]); $row[numbers]=implode("|",$row[numbers]); mysql_query("UPDATE `` SET `numbers`='$row[numbers]' LIMIT 1"); } and done and done :-)
  5. dont use [ # ]'s... they complicate life... use the table names instead... <a href="productimages/<?=$row[5];?>" rel="lightbox" ><img src="productimages/<?=$row[6];?>" width="160" height="160" />[/url] what does get output to your browser's source?
  6. where is that list of numbers in that code? i'm not showing any loops there atall...?
  7. ya... javascript forcing $_POST... its not easy... but is doable, and no... javascript's window.open() doesnt pass variables, it only passes the configuration of the browser... your best choice... is either setting the cookies, or using $_GET
  8. ya... its prolly faster to make a new table at that number of users... on your login... mysql_query("INSERT ... (id,name,timestamp)..."); then on every page... $timeout=time()+3600; #now +1 hour $query=mysql_query("SELECT `id` FROM ... WHERE `timestamp`<='$timeout' "); while($row=mysql_fetch_assoc($query)){ mysql_query("DELETE FROM ... WHERE `id`='$row[id]' LIMIT 1"); } so you only got people that have been online in the last hour... you can then query to build your lists accordingly :-)
  9. edit()'s function requires a $row... a 3rd value... you either need to add $row="", or, put some value in there... default: switch ($task) { case "save" : save($option); break; case "edit" : edit( $option, $id ); break; case "new" : $id = ''; edit( $option, $id); break;
  10. maybe if we could see the form?
  11. why are you doing date($ro)? the $ro already holds a date...
  12. the "only" way of passing variables from javascript to php(other then via post/get)... is by cookies... your javascript sets a cookie, with some information, your php picks it up.
  13. no... mysql_free_result(); only works on querys... unset($var1,$var2); works on variables... is the memory leaks coming from your php? of from the javascript...? javacript leaks are FAR more common...
  14. for logins... and for all form data... never ever ever ever(get the picture?)!!! use $_GET... always send stuff via $_POST if you can...
  15. if you sort()/natsort() it'll realign that array for ya
  16. $array=glob('images/*'); foreach($array as $v){ echo '<img src="'.$v.'">'; }
  17. i have a link to one at home... shoot me an email
  18. echo '<div> <B>Title</b><span style="width:100%; text-align:right;">'.$row['Title'].'</span>';
  19. <span style="width:100%; text-align:right;"></span>
  20. sorry... thats not vague enough... please try to be a little less specific LOL um... basically you start with a template... then you add a little more... then you add a little more... then you add a little more... then you add a little more... then you add a little more... then you add a little more... then you add a little more... DEBUG then you add a little more... then you add a little more... then you add a little more... then you add a little more... then you add a little more... then you add a little more... then you add a little more... then you add a little more... DEBUG then you add a little more... then you add a little more... then you add a little more... DEBUG then you add a little more... then you add a little more... then you add a little more... then you add a little more... then you add a little more... then you add a little more... DEBUG (repeat untill your done!)
  21. call your isp, get their smtp server information, then put those servers, into your php.ini...
  22. apache itself is a web server... not an smtp server... it would only send emails through your ISP... you want your php.ini settings to match those from your ISP...
  23. here ya go... simplified :-) <html> <head> <LINK href="style.css" rel="stylesheet" type="text/css"> <?php $title="Inbox"; require("navtemp.inc"); require("serverinfo.inc"); if(isset($_COOKIE['userid'])){ $username=$_COOKIE['username']; echo "Welcome ".$username." to your inbox!<br />"; echo "<a href='newPM.html' target='_blank'>Compose a new message</a><br />"; }else die("Your not logged in! Log in!"); $body.='<form action="deletemsg.php" method="post">'; $body.='<table align="center"><tr border="1"><td>FROM</td><td>SUBJECT</td><td>CREATED</td><td>DELETE</td><td>VIEW</td></tr>'; $query=mysql_query("SELECT * FROM myPM WHERE pmto='$username'") or die(mysql_error()); if(mysql_num_rows($query)>0){ while($row=mysql_fetch_assoc($query)){ $body.=' <tr>'; $body.=' <td>'.$msg1['pmfrom'].'</td>'; $body.=' <td>'.$msg1['pmtitle'].'</td>'; $body.=' <td>'.$msg1['pmdate'].'</td>'; $body.=' <td>'.$formset.'<input type="hidden" name="msg" value="'.$msg1['pmid'].'"><input type="submit" value="delete"></form></td>'; $body.=' <td><form method="post" action="viewmsg.php"><input type="hidden" name="viewmsg" value="'.$msg1['pmid'].'"><input type="submit" value="view"></form></td>'; $body.=' </tr>"; } }else $body.='<tr><td rowspan=5>You have no new messages.</td></tr>'; $body.='</table></div></body></html>'; echo $body; ?> sorry... did about a dozen updates... it should be done now :-)
×
×
  • 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.