phpretard
-
Posts
821 -
Joined
-
Last visited
Never
Posts posted by phpretard
-
-
That is as close as I have gotten thus far.
So I ticked the first 5 checkboxes and it only inserted a single "1"; the other 4 were "ignored". Any thoughts?
What do you mean "secure my inputs"?
-
There are 45 text fields (catID) and 45 corresponding checkboxes (score)
<form>
// in a while loop that stops at 45
<input type="text" name="catID[]" value="<? echo $test['id']; ?>" readonly />
<input type="checkbox" name="score[]" value=\"1\" /> incorrect
// end in a while loop
<br />
<input type="submit" name="submit_test" value="Submit" />
</form>
-
This might help explain...
foreach($_POST['catID'] as $catID){ if ($_POST['score'] == "1"){ // represents a checkbox with a value of 1 $insert = mysql_unbuffered_query(" insert into test_results values('".$_POST['id']."', '$catID', '1') "); }else{ $insert = mysql_unbuffered_query(" insert into test_results values('".$_POST['id']."', '$catID', '0') "); } }
-
The reason I need the foreach is because there are 45 catID[] that should correspond with 45 score[]
if catID's value is 5 and score is checked the vars I need would be: "$catID = 5 , $score = 1"
<? foreach($_POST['catID'] as $score){ //insert values "$catID = 5 , $score = 1" } ?> <form> // in a while loop <input type="text" name="catID[]" value="<? echo $test['id']; ?>" readonly /> <input type="checkbox" name="score[]" value=\"1\" /> incorrect // end in a while loop <br /> <input type="submit" name="submit_test" value="Submit" /> </form>
Thank you for the help!
-
"So Helpful"
I don't know if you are kidding. This is what I use to force a download though.
-
I don't want to have to manually set up a cron job everytime I set up a domain
-
I use $_GET
<?php $Type = $_GET['source']; $id = $_GET['id']; $track = $_GET['track']; $doc=$_GET['doc']; $file_path = $_SERVER['DOCUMENT_ROOT']."/orders/".$track."/".$doc; if (file_exists($file_path) && !is_dir($file_path)) { header('Content-type: application/octet-stream'); header("Content-Disposition: attachment; filename=\"".$doc."\""); header('Content-Length: ' . filesize($file_path)); ob_clean(); flush(); readfile($file_path); exit; } else { header ("HTTP/1.0 404 Not Found"); exit; } ?>
-
I'm not sure I do either
Can I write $this into linux using exec() not having to use SSH or Plesk?
$this="*/1 * * * * /usr/bin/php /var/www/vhosts/website.net/httpdocs/a_assign_appraiser.php"
-
So I have files in a Plesk Skeleton for newly added domains.
Within the files there are a few that requires cron for the site to run properly.
With exec() I can write this into linux?
-
I know how to setup cron. I need to know if there is a way to setup cron via php.
For example. When you install wordpress or Joomla there is a wizard of sort to install the database and configure some files.
Is there such a script to do the same with cron?
-
-
I am trying to dislay a negative number without the minus sign.
If the math come out to $-50.00 I need it to display $50.00.
If it comes out to $50.00 then I need it to display $-50.00.
Here is what I thought was working...
$grandTotal="-50.00"; if ($grandTotal <= 0) { $grandTotal = explode('-', $grandTotal); echo "$".number_format($grandTotal[1], 2); }else{ $grandTotal = number_format($total - $subtract, 2); echo "$-".number_format($grandTotal, 2); }
It did work for a few instances but now it's giving me problems.
Any thoughts?
-
$i=mysql_num_rows($result); while($row = mysql_fetch_array($result)) { $name=$row['firstname']; $yrow=$row['gender']; $xrow=$row['level']; echo "$i. $name - [village] $xrow | $yrow [/village] <br>"; $i++; }
-
echo "$".number_format($total - $subtract, 2);
-
$stop=mysql_num_rows($result); for($i = 1; $i < $stop; $i++) { echo "$i".$row['name']." - "."[village]".$row['x']."|".$row['y']."[/village]"."<br>"; }
-
it could be:
$stop=mysql_num_rows($queryName);
20 is just a number I made up...
The $stop is there in case you need to paginate later. You don't have to stop it at all.
-
$stop="20"; //<< count the rows in the DB for($i = 1; $i < $stop; $i++){ echo "$i. your stuff<br />"; }
-
How I get ".00" to show if there is nothing after the decimal in the Database.
For example if I insert 2.00 [decimal (10,2)] in the database the php will only display the ".00" if there is a value after the decimal.
The code works fine it's the .00 that's got me.
function getBalance(){ connect(); $balanceQ=mysql_query("select cart.eventID, cart.userID, competitions.id, competitions.price, competitions.coachcost FROM cart LEFT JOIN competitions ON competitions.id = cart.eventID where cart.userID='123' ") or die(mysql_error()); while($balance=mysql_fetch_assoc($balanceQ)) { $total +=$balance['price'] + $balance['coachcost']; } // get previous payments $historyQ=mysql_query("select * from account where userID='123' "); while($history=mysql_fetch_assoc($historyQ)) { $subtract +=$history['amount']; } free($balanceQ); free($historyQ); echo "$".($total - $subtract); //<<<< PROBLEM }
Any help?
-
Inside of a while loop I need to echo several rows of info...easy enough.
In the loop (for the sake off css) I need to distinguish between odd and even row numbers.
<? connect(); $documentQ=mysql_query("select * from docs"); while($doc=mysql_fetch_assoc($documentQ)) { echo" <li class=\"oddrow\"><a href="docs/notes/PrincipalsNotes_0911.doc\">November</a></li> <li><a href=\"docs/notes/PrincipalsNotes_0910.doc\">October</a></li> <li class=\"oddrow\"><a href=\"docs/notes/PrincipalsNotes_0909.doc\">September</a></li> "; } free($documentQ); ?>
Male sence?
Any thoughts?
-
Thank you!!!!!!
-
It wont go if this is how you have it..
$header="from: your name <your email>"; change to $header="from: phpretard <email@youremail.com>";
-
What the heck am I doing wrong???
<? if (isset($_POST['submit'])){ echo $_POST['theNumber']."<br />"; convertNumber($_POST['theNumber'])."<br />"; echo $output; // <-- ??? } ?> <form action="" method="post"> <input type="text" name="theNumber" /><input type="submit" name="submit" value="go" /> </form>
Still notta.
-
I added this to the bottom of the page...
<? if (isset($_POST['submit'])){ echo $_POST['theNumber']."<br />"; convertNumber($_POST['theNumber']); } ?> <form action="" method="post"> <input type="text" name="theNumber" /><input type="submit" name="submit" value="go" /> </form>
It output the number but still not the text...?
-
When I run into session problems I always start with the basics and make sure the correct session isset:
<? echo "<pre>". print_r($_SESSION,true) ."</pre>"; echo "<pre>". print_r($_COOKIE)."</pre>"; ?>
FOREACH HELP NEEDED
in PHP Coding Help
Posted
FREAKS RULE!
THANK YOU!!!