taith
Members-
Posts
1,514 -
Joined
-
Last visited
Everything posted by taith
-
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>
-
um... what type of loop? what are you expecting to get out? what do you have going in?
-
that there is not a popup... or atleast from the code you gave.
-
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 :-)
-
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?
-
where is that list of numbers in that code? i'm not showing any loops there atall...?
-
Got advice on "who's online" php/mysql structure?
taith replied to mikenl's topic in PHP Coding Help
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 :-) -
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;
-
maybe if we could see the form?
-
why are you doing date($ro)? the $ro already holds a date...
-
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...
-
for logins... and for all form data... never ever ever ever(get the picture?)!!! use $_GET... always send stuff via $_POST if you can...
-
if you sort()/natsort() it'll realign that array for ya
-
$array=glob('images/*'); foreach($array as $v){ echo '<img src="'.$v.'">'; }
-
i have a link to one at home... shoot me an email
-
echo '<div> <B>Title</b><span style="width:100%; text-align:right;">'.$row['Title'].'</span>';
-
<span style="width:100%; text-align:right;"></span>
-
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!)
-
yes... it still matters...
-
call your isp, get their smtp server information, then put those servers, into your php.ini...
-
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...
-
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 :-)