-
Posts
1,842 -
Joined
-
Last visited
Posts posted by marcus
-
-
You're missing the semi-colon on your mysqli_close line.
-
The question seems a bit ambiguous, I'm not sure if what I've derived is what you want but...
You can use array_keys on your $_POST variable. That will store just the names of the values sent. So if the user only passed username and email the array would be:
Array ( [0] => username [1] => email )
-
echo $array[5]['name'];
-
He's trying to imply "post your code."
-
Are you trying to store all of the player names in an multi-dimensional array? So that msgColor1 is an array and has an array inside of it with the key named "name" and each value of the array "name" has each of the player names?
If that's the case:
foreach($playerName1 AS $value){ $msgColor1['name'][] = $value; }
And calling print_r on msgColor1 will give you an output of something similar to:
Array ( [name] => Array ( [0] => johnny [1] => bob [2] => malcolm ) )
-
-
Sure, but what is $charname supposed to be?
-
if($fighter[$i] != $charname){
No where in your code is $charname ever defined.
-
I thought it was funny. And only the person using the code should have to know what it means.
-
Why would you need to use Javascript for this? It's simply just using
<input type="checkbox" name="interest[]" value="hockey">
for all interests.
<form method="post"> <input type="checkbox" name="interest[]" value="hockey" />Hockey<br /> <input type="checkbox" name="interest[]" value="soccer" />Soccer<br /> <input type="checkbox" name="interest[]" value="baseball" />Baseball<br /> <input type="checkbox" name="interest[]" value="basketball" />Basketball<br /> <input type="submit" name="submit" value="Delete Selected Interested" /> </form> <?php if($_POST['submit']){ $interests = $_POST['interest']; if(count($interests) > 0){ foreach($interests AS $interest){ $sql = "DELETE FROM `interests` WHERE `interest`='".mysql_real_escape_string($interest)."'"; $res = mysql_query($sql) or die(mysql_error()); echo htmlentities($interest) . " has been removed!"; } } } ?>
Obviously other security measures could be implemented.
-
If we didn't use the third parameter of 2 in the explode call we would be splitting the string into n pieces when a string comes up. But since we only want 2 it will only split the string into 2 parts, one that is the data before the first space and another that is the data after the first space.
-
What I did was took your example of the timestamp being used. You want to rid of the HH:MM:SS, so by splitting up your string (using explode) and limiting it to 2 outcomes we are able to make two separate strings, one that is HH:MM:SS and one that is DD Mmm YY, YYYY PST.
-
It's a ternary operator.
It's a condensed if statement practically.
$var = (CONDITIONAL STATEMENT) ? TRUE : FALSE;
-
<?php $s = 'HH:MM:SS DD Mmm YY, YYYY PST'; $e = explode(' ',$s,2); $first_part = $e[0]; $secnd_part = $e[1]; ?>
-
<select name="mediaList" id="mediaList"> <?php $options = array('Physical Only', 'Checkup Only', 'Both'); foreach($options AS $option){ $selected = ($option == $rows['media_type']) ? ' SELECTED' : ''; echo '<option'.$selected.'>'.$option.'</option>' . "\n"; } ?> </select>
-
You need to surround your math with parenthesis, and you're missing a parenthesis to end your conditional statement.
$file_string .= ($article_id == count($xml->channel->item)) ? '<a>></a>' : '<a href="#' . ($article_id-1) . '">></a>';
-
Are you sure that's the whole code? Seems to me there's some conditional statement we can't see. Are there statements in header.php?
You're closing a statement when a statement hasn't even been called.
-
$month='Feb'; $query = "SELECT date FROM table WHERE date LIKE '$month%'"; $result = mysql_query($query) or die(mysql_error()); $events = array(); while($row = mysql_fetch_array($result)) { $events[] = substr($row['date'], 3); } echo implode(',', $events);
-
Have the form targeted to the iframe.
<form method="post" action="chat.php" target="iframe_name">
-
Like if statements to check whether or not the "message ID" exists and belongs to that user?
<form method="post"> box 1 <input type="checkbox" name="box[]" value="1"><br /> box 2 <input type="checkbox" name="box[]" value="2"><br /> box 3 <input type="checkbox" name="box[]" value="3"><br /> <input type="submit" name="submit" value="View Checked Boxes"> </form> <?php if(isset($_POST['submit'])){ $box = $_POST['box']; // this will be an array if(count($box) > 0){ foreach($box AS $id){ $sql = "SELECT * FROM `messages` WHERE `id`='".mysql_real_escape_string($id)."'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) > 0){ // msg exists $row = mysql_fetch_assoc($res); if($row['uid'] == $_SESSION['uid']){ // msg belongs to logged in user $sql2 = "DELETE FROM `messages` WHERE `id`='".mysql_real_escape_string($id)."'"; $res2 = mysql_query($sql2) or die(mysql_error()); // msg deleted }else { // msg doesn't below to user, nothing is deleted // you can put your error msgs in here if you want } }else { // msg doesn't exist, nothing is deleted // you can put your error msgs in here if you want } } } } ?>
-
<?php $date = date("m-d-y"); // 08-12-10 $dates = array('08-12-10','08-13-10','08-14-10','08-15-10'); $hm = date("H:i"); // 15:47 list($hour,$minute) = explode(":",$hm); if(in_array($date,$dates) && $hour == '22' && in_array($minute,range(0,59))){ // code } ?>
-
Process the form using the same parameters the AJAX function is using, as well as using the same file to execute it upon.
-
$sql = "SELECT * FROM `users` WHERE `inst_id`='".$userarray['inst_id']."' AND `id`<> '".$userarray['id']."'";
-
mod rewrite.
Custom Function Help
in PHP Coding Help
Posted
Make your connection line: