-
Posts
1,842 -
Joined
-
Last visited
Posts posted by marcus
-
-
Put quotes around your recipient.
-
You can obviously tell he only copied and pasted it, I'm sure he'd've read it if he really wanted to.
-
Maybe if he actually WANTS to learn the fricekn thing, he'll take the time and watch it. But copy and pasting won't get him anywhere.
-
Try using my example. That tutorial is horrible and shouldn't be used.
-
$new_games = mysql_query9"SELECT game_picture_url, title FROM `game` ORDER BY title") or die(mysql_error());
You have an extra comma after title.
-
Hmm, why marble? Singling out granite and other stones?
-
Try using my example. That tutorial is horrible and shouldn't be used.
-
Lol. use phpDesigner 2008.
-
<?php $day = date("j"); // 1-31 $month = date("n"); // 1-12 $year = date("Y"); $sql = "SELECT * FROM `calendar` WHERE `day`='".$day."' AND `month`='".$month."' AND `year`='".$year."'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) == 0){ echo "Today is a boring day, nothing is happening!"; }else { echo "<table border=\"0\" cellspacing=\"3\" cellpadding=\"3\">\n"; while($row = mysql_fetch_assoc($res)){ echo "<tr><td>".$row['event']."</td></tr>\n"; } echo "</table>\n"; } ?>
-
<?php if(!$_POST['submit']){ // form }else { $user = mysql_real_escape_string($_POST['username']); $pass = mysql_real_escape_string($_POST['password']); $errors = array(); if(!$user){ $errors[] = "You did not supply a username"; }else { if(!in_array(strlen($user),range('3','32'))){ $errors[] = "Username must be between 3 and 32 characters"; } if(!ctype_alnum($user)){ $errors[] = "Username can only contain alphanumerical characters"; } $sql = "SELECT * FROM `users` WHERE `username`='".$user."'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) == 0){ $errors[] = "The username already exists in the database"; } } if(!$pass){ $errors[] = "You did not supply a password"; }else { if(strlen($pass) < 6){ $errors[] = "Your password must be greater than or equal to 6"; } } if(count($errors) > 0){ echo "The following errors occurred:<br>\n"; foreach($errors AS $error){ echo $error . "<br>\n"; } }else { $sql2 = "INSERT INTO `users` (`username`,`password`) VALUES('".$user."','".sha1($pass)."')"; $res2 = mysql_query($sql2) or die(mysql_error()); echo "You have successfully registered as ".$user."!\n"; } } ?>
give that a go.
-
<?php for ($i = 1; $i <= 3; $i++) { $time = $_POST['time-' . $i]; if ($time) { $scheduleinsert = "INSERT INTO `schedules` (`eventid`, `time`, `grades`, `room`, `notes`) VALUES ('" . $eventid . "', '" . $time . "', '" . $grades . "', '" . $room . "', '" . $notes . "')"; $schedule_result = mysql_query($scheduleinsert); } } ?>
Just make sure you have the other variables defined.
-
You need to have both a sort and order by variable.
You can remove this fuss and do something like:
function dispDip($sortby = 'clan', $sortorder = 'ASC'){ $SORT_END = "ORDER BY ".$sortby." ". $sortorder; }
-
Custom function, we're going to need to see code.
-
<?php function BuyMS($user, $wal, $type) { $noNaquadah = "Not enough Naquadah!"; $nosold = "Not enough untrained units!"; if ($type == 0) { $pris = 350000000 * $wal; if ($pris <= ($user->gold)) { $q = @mysql_query("select Mothership from `UserDetails` where ID='$user->ID' "); $el = mysql_fetch_array($q, MYSQL_ASSOC); if ($el[] >= $wal) { // error on this line. $q = @mysql_query("update `UserDetails` set Mothership = 1, gold=gold-'$pris' where ID='$user->ID' "); if (!$q) { print ('Query failed: ' . mysql_error()); return; } } else return $nosold; } else return $noNaquadah; } if ($cgi[buyMS]) { if ($cgi[Mothership]) { $wal = $cgi[Mothership]; $typ = 0; $detail .= Mothership($user, $wal, $typ); } } } ?>
since he's lazy.
-
<input type="checkbox" name="name[]" value="1"><br> <input type="checkbox" name="name[]" value="2"><br> <input type="checkbox" name="name[]" value="3"><br> <input type="checkbox" name="name[]" value="4"><br> <input type="checkbox" name="name[]" value="5"><br>
<?php $name = $_POST['name']; if(count($name) > 0){ foreach($name AS $names){ echo $names . "<br>\n"; } }else { echo "Please select one!\n"; } ?>
-
<?php foreach($_POST AS $key->$val){ echo $key . " has the value of " . $val . "<br>\n"; } ?>
-
Let them submit the username, and you find a cruel punishment for them
-
<?php $username = "marcus"; $bad = array('fuck','ass','rape'); foreach($bad AS $duh){ if(preg_match("/$duh/is",$username)){ $err = 1; } } if($err){ echo "Invalid username!\n"; }else { echo "Nice username! -wink-\n"; }
With username -> marcus Nice username! -wink-
With username -> marcusfuck Invalid username!
-
<?php $text = "bubbles"; echo $text; unset($text); echo $text; ?>
-
Fert what if
$text = "A dog is a mans best friend";
Your code would return
A dog ismans best friend
-
Lol.
php.net/ctype_alnum
Alphanumeric characters.
<?php $good = "ily"; $bad = "ihy!"; if(ctype_alnum($good)) echo "You win!\n"; else echo "You fail!\n"; echo "<br>\n"; if(!ctype_alnum($bad)) echo "You fail!\n"; else echo "You win!\n"; ?>
-
Yeah, what they said. By the way, my town sucks.
-
Ok, when the user views the haggling window that shows the item, the price and an input box to input their haggled price it sets the session "buy" to the value "yes." When the user submits their haggle it goes to the next part and all the security stuff, do they have enough points, is the haggle high or low enough, etc... If they pass all that they get the item and the session is destroyed. Before all the security stuff (when the form is submitted) it checks if the session exists, if it does, they can continue, but if it doesn't they tried to refresh and buy the item again. My problem is, the session is destroyed even before the user is able to buy the item.
-
No, just update where their last click was.
PHP or is this CSS?
in CSS Help
Posted