taquitosensei
-
Posts
676 -
Joined
-
Last visited
-
Days Won
2
Posts posted by taquitosensei
-
-
$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.
-
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']; }
-
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
-
it sounds like magic_quotes_gpc is on try turning it off in .htaccess with
"php_flag magic_quotes_gpc off"
or you can stripslashes($string) on your output
-
You can't with php because php is server side so it can't see the local lan for your client. You may be able to with javascript.
-
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.
-
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.
-
Decode them on output.
html_entity_decode($string);
-
Yes it is. Take a look at.
-
yourloophere { $total+=$price; }
-
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
-
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); } ?>
-
use mysql_fetch_assoc instead.
mysql_fetch_row returns a numerically indexed array.
mysql_fetch_assoc returns an associative array.
-
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']."'";
-
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"));
-
I don't think you asked a question or told us what the problem is. <- Me trying to read your mind.
-
It's probably returning False because it couldn't connect, you didn't select a database, query is bad etc..
Strip comma at end of loop
in PHP Coding Help
Posted
something like this