taquitosensei
Members-
Posts
676 -
Joined
-
Last visited
-
Days Won
2
Everything posted by taquitosensei
-
You beat me to it.
-
PHP page ignoring CSS text formatting
taquitosensei replied to scottchr226's topic in PHP Coding Help
view the source in your browser make sure there's no unexpected output and that the classes/ids actually match what's in your css. -
something like this $glue=""; foreach($yourarray as $item) { print($glue."[". $current_month .",". number_format($remaining_balance, "2", ".", ",") . "]"); $glue=","; }
-
$days=ceil(strtotime($future_timestamp)-strtotime(date("Y-m-d"))/86400)
-
also if you're looking for the last inserted id I would use this select last_insert_id() as lastid from table limit 1 that actually gets the id of the last row inserted by the current connection. This saves you headaches further down the road if you get more than one connection putting data into your database.
-
How to get the first element in the Associative array.
taquitosensei replied to theITvideos's topic in PHP Coding Help
also if you're going to have more than one character it would look like this. $characters = array ( array ( "name"=>"Joe", "occupation"=>"Programmer", "age"=>30, "Learned language "=>"Java" ) ); foreach($characters as $character) { echo $character['name']; } -
Choosing random strings from a group
taquitosensei replied to giraffemedia's topic in PHP Coding Help
array_rand(); $product_1 = '<h2>Test Product 1</h2><p>skdug sdkhg ks dkghjs kjsd jhfs dfklj</p><img src="images/test/test1.gif" align="left" height="50" width="50" border="0" />'; $product_2 = '<h2>Test Product 2</h2><p>skdug sdkhg ks dkghjs kjsd jhfs dfklj</p><img src="images/test/test2.gif" align="left" height="50" width="50" border="0" />'; $product_3 = '<h2>Test Product 3</h2><p>skdug sdkhg ks dkghjs kjsd jhfs dfklj</p><img src="images/test/test3.gif" align="left" height="50" width="50" border="0" />'; $products = array($product_1, $product_2, $product_3); $rand_products=array_rand($products,3); // this gives you an array with your 3 random elements -
how to use session_id('my_session_id') after the first page
taquitosensei replied to niranjan81's topic in PHP Coding Help
I'm pretty sure its as easy as. session_start("yourcustomsessionname"); then just use that to start the session at the top of each page that will use it. -
grab text from textarea and store in session
taquitosensei replied to MDanz's topic in PHP Coding Help
not without using ajax to send to the server then redirect to your next page. At that point you might as well just submit the form. Since you're going to another page anyways. -
Yes it is. Take a look at. http://pear.php.net/package/Net_POP3/
-
yourloophere { $total+=$price; }
-
my status echos are on the top of my page...
taquitosensei replied to navybofus's topic in PHP Coding Help
It's probably because your using tables and your echo is not in the table structure. Just lay out your table structure so it includes your echo. -
as best as I can tell $age=520; $remainder=$age%50; // % gets the remainder of division $amount=floor($age/50); // divide by 50 then round down. Gets the number of times 50 goes in to the age. // loop for each time 50 goes into $age for($a=0;$a<$amount;$a++) { // send 50 to your site } // send remainder to your site
-
Checking radio button according to database content
taquitosensei replied to captain_scarlet87's topic in PHP Coding Help
I think you're in the wrong forum. This looks like a variant of ASP. Definitely not PHP. PHP opening and closing tags would be <?php ?> -
It's combining your 2 queries. It's selecting everything from comments and users where the name in comments = the name in users and Comments.id=$t let's say I have this table structure Comments comments name id Hi long time lurker, first time poster tom 1 Am I the only on here? tom 2 Users name id tom 1 This query select * from Comments JOIN Users on Comments.Name=Users.Name where Comments.id=1 would give you Comments.comment Hi long time lurker, first time poster Comments.name tom Comments.id 1 Users.name tom Users.id 1
-
it would kind of work. Something like this would work better. <?php $result4 = mysql_query("SELECT * FROM comments JOIN Users on Comments.Name=Users.NameWHERE Comments.id=$t"); while($row = mysql_fetch_assoc($result4)); { $to = $row['email']; $subject = 'the subject'; $message = 'hello'; $headers = 'From: webmaster@example.com' . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); } ?>
-
Confusing mysql_fetch_row output problem
taquitosensei replied to OriginalSixRules's topic in PHP Coding Help
use mysql_fetch_assoc instead. mysql_fetch_row returns a numerically indexed array. mysql_fetch_assoc returns an associative array. -
Script taking a long time to run. (Send mail)
taquitosensei replied to New Coder's topic in PHP Coding Help
first thing I noticed $num = mssql_num_rows($rs); if ( $num !=0 ) { if (mssql_num_rows($rs)) { could be shortened to if(mssql_num_rows($rs)!=0) { -
if this $sql = "SELECT * FROM inbox WHERE product_id = '".$_GET['id']."' AND from != 'admin'"; works Then so should this $sql = "SELECT * FROM inbox WHERE product_id = '".$_GET['id']."'";
-
Need help with correct syntax for "if" condition
taquitosensei replied to capella07's topic in PHP Coding Help
this should work $bigstring = "automobile"; $littlestring = "mobile"; if( !strpos($bigstring, $littlestring) ) { // Do something } you had an extra "(" -
It's a line break for a text file. "\r\n" would cover unix and windows.
-
This should do it. echo date("Y-m-d", strtotime($_GET['search'],"+1 Days"));