-
Posts
1,807 -
Joined
-
Last visited
Everything posted by hitman6003
-
http://phpmailer.sourceforge.net/
-
$text = "name0|number0; name1|number1; name2|number2"; $lines = explode(";",$text); foreach ($lines as $line) { $line = explode("|", trim($line)); $names[$line[0]] = $line[1]; } asort($names); $keys = array_keys($names); $num = rand(0, count($names)); echo "<pre>" . print_r($names, true) . "</pre>"; echo "{$names[$keys[$num]]} has won with the number: {$num}";
-
Try removing the 'header("location: nextpage.php")' lines from your code. With out seeing your code, there is no more help we can provide.
-
This should work. Note that asort doesn't need to be assigned to a variable, it is executed on an array, and returns true or false. Also note that you could potentially be in the while loop for a VERY long time if there is more than a couple of elements in the $names array using your current code. $names = "name|number; name|number; name|number"; $lines = explode(";",$_POST['names']); foreach ($lines as $line) { $line = explode("|", trim($line)); $names[$line[0]] = $line[1]; } asort($names); $num = rand(0, $names[0]); echo $num; echo "<pre>" . print_r($names, true) . "</pre>"; $win = 0; while($win == 0) { foreach ($names as $key => $value) { if ($value == $num) { echo "{$key} has won with the number: {$value}"; $win = 1; } } $num = rand(0,$names[0]); }
-
Display last 5: $query = "SELECT * FROM tablename ORDER BY id DESC LIMIT 5"; $result = mysql_query($query) or die(mysql_error()); echo ' <table> <tr> <th>Order</th> <th>Name</th> </tr>'; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo ' <tr> <td>' . $i . '</td> <td>' . $row['LastName'] . ', ' . $row['FirstName'] . '</td> </tr>'; } echo ' </table>'; Change the LIMIT clause on the sql query to select different ones...for example "LIMIT 1" would get the most recent, "LIMIT 1, 1" would get the second most recent.
-
[SOLVED] Trying to Insert to one table, update to another
hitman6003 replied to vynsane's topic in PHP Coding Help
YOu have to do two seperate queries.... mysql_query("INSERT INTO table (newthing, othernewthing) VALUES ('$newthing', '$othernewthing')") or die(mysql_error()); mysql_query("UPDATE othertable SET updatedthing=$updatedthing, otherupdatedthing=$otherupdatedthing WHERE id = " . mysql_insert_id()) or die(mysql_error()); -
SELECT pat_id, admit_status, admit_loc, admit_date, discharge_date, admit_encounter FROM admission WHERE (pat_id = '$pat_id') ORDER BY admit_date DESC LIMIT 1
-
Can anyone suggest how approach this requirement
hitman6003 replied to Lassie's topic in PHP Coding Help
Just change the where clause: SELECT oc.order_number, p.product_id, p.title FROM order_contents oc LEFT JOIN products p ON oc.product_id = p.product_id WHERE oc.customer_name = "Some Customer" ORDER BY oc.order_number Then use php to generate a table: $result = mysql_query("...") or die(mysql_error()); echo '<table>'; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo ' <tr> <td>' . $row['order_number'] . '</td> <td>' . $row['prodcut_id'] . '</td> <td>' . $row['title'] . '</td> </tr>'; } echo '</table>'; -
Can anyone suggest how approach this requirement
hitman6003 replied to Lassie's topic in PHP Coding Help
Use a join to grab the info you want in a single query.... SELECT p.title FROM order_contents oc LEFT JOIN products p ON oc.product_id = p.product_id WHERE oc.order_number = $order_number There is no need to wrap the $order_number in single quotes assuming that the order_number column is an INT...when you do it causes MySQL to have to do a type conversion. -
strlen and strpos http://www.php.net/strlen http://www.php.net/strpos
-
do a print_r on $_POST, $_SESSION, and $_FILES to make sure that the variables you think are there, are actually there.
-
You might want to look at how some other people have done what you want...one of the more robust document management systems is knowledge tree... http://www.knowledgetree.com/ They have an open source version that you can download and play with if you like.
-
Use the mysql UNION.... http://dev.mysql.com/doc/refman/5.0/en/union.html
-
[SOLVED] Is there any way to persist objects between php pages?
hitman6003 replied to dead_elves's topic in PHP Coding Help
Use sessions or cookies.... http://us2.php.net/manual/en/ref.session.php -
Write your own script.....it's the only way to be sure you are migrating correctly
-
Google cache: http://209.85.165.104/search?q=cache:jAL3ZxHyUQcJ:dev.mysql.com/doc/en/SELECT.html+mysql+limit&hl=en&ct=clnk&cd=1&gl=us
-
There is a lot of different ways.... You can write a custom conversion script that will extract the data from Access and insert it into MySQL. You can export the data from Access, then, again using a custom script, insert it into MySQL. There is a MySQL ODBC connector that you can use to go directly between Access and MySQL, however your table structure would have to be EXACTLY the same for it work...and even then there is no guarantee. There is no easy way however...at least not without using some sort of conversion product...which probably isn't free. Make sure you have a back up of both databases before you try anything......
-
If he is the one doing the changes to the string, then as the changes are done the highlights can be made...I don't think it's possible to highlight the changes after the fact...at least not accurately.
-
Look here: http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html
-
Md5 is not easily breakable...to my knowledge it hasn't been broken...if someone claims to be decrypting it they most likely are comparing an md5 string against a database of known values.
-
how can i get how many times for db?
hitman6003 replied to just me and php's topic in PHP Coding Help
SELECT name, COUNT(name) FROM tablename GROUP BY name -
SELECT news_picture FROM fusion_news ORDER BY id DESC LIMIT 1
-
Well a quick google search yielded these two results. Most likely the solution you find will have some java involved...and generally the best of them will be a java applet that handles the file uploads for you. http://www.telio.be/blog/2006/01/06/ajax-upload-progress-monitor-for-commons-fileupload-example/ http://kencochrane.blogspot.com/2006/03/ajax-struts-file-upload-progress-meter.html
-
Follow skali's suggestion...most likely you are looking at your output text in notepad, which doesn't recognize only "\n" as a line separator. If you open the text document in wordpad it will show correctly.