RussellReal
Members-
Posts
1,773 -
Joined
-
Last visited
Everything posted by RussellReal
-
help? where to put substr function in gallery script...
RussellReal replied to annieone's topic in PHP Coding Help
oh yeah =\.. 0 would be from the start 1 would be after the first, sorry bro premiso is right -
wow, or that, mysql is intense =o
-
because $row['table_primary'] is not the same as $table_primary lol
-
help? where to put substr function in gallery script...
RussellReal replied to annieone's topic in PHP Coding Help
substr($dir,1) should fetch the whole string except the first 2 characters, note: indexs start at 0 -
well.. lets break that down; 1) Your script will ONLY be affecting the rows which are older than 10 minutes, if I'm right continue onto step 2.. 2) in order to select rows older than 10 minutes, what would be a good query, -->a) (IF UNIX TIMESTAMP) "SELECT * FROM `table` WHERE `theTimestamp` < '".(time() - (60 * 10))."'" -->b) (IF DATETIME FIELDTYPE) "SELECT * FROM `table` WHERE `theTimestamp` < DATE_SUB(NOW(),INTERVAL 10 MINUTE b) 3) grab the results $qry = mysql_query($sql); while ($r = mysql_fetch_assoc($qry)) { $results[] = $r; } // see step 4 4) do the math on each result, possibly in a foreach for the array $results, gather the ids and the time difference, then do the changes in another query
-
[SOLVED] Data not being escaped? - [ Mysqli, phpmyadmin ]
RussellReal replied to Boo-urns's topic in PHP Coding Help
^^ yeah basically what I said, but probably more understandable lol -
[SOLVED] Data not being escaped? - [ Mysqli, phpmyadmin ]
RussellReal replied to Boo-urns's topic in PHP Coding Help
basically escaping the data is to get it successfully to the database if inside your string somewhere you have a ' it will kill the query thats why it turns ' into \', but when it reaches the database it will have been escaped in the query, therefore it will show up correct in the database, you most likely as wolf states gave magic quotes on, so, you'd want to stripslahes -
while($assoc = mysql_fetch_assoc($q)){ $test = $assoc; if($assoc['floor_area_num'] != "" && $assoc['AskingPrice'] != ""){ $test['PricePerSqFt'] =intval(0.5+$assoc['AskingPrice']/$assoc['floor_area_num']); } }
-
if (file_exists('$file')) { is where your problem is ' single quotes do not evaluate variables, use double quotes or no quotes at all.. you don't need to quote variables. if (file_exists($file)){
-
storing it in a file?
-
$conn = db_connect(); $result = $conn->query("SELECT * FROM notice_board"); $result2 = $conn->query("SELECT COUNT(*) FROM notice_board"); while($row = $result->fetchObject()) { $column = $result2->fetchColumn(); echo '<tr>'; echo '<td>'.$row->id.'</td><td>'.$row->type.'</td><td>'.$row->entry.'</td><td>'.$row->sl.'</td><td>'.$row->tp.'</td><td>'.$row->notes.'</td><td>'.$row->changes.'</td>'; echo '</tr>'; } $conn = NULL;
-
[SOLVED] Two tables comparision in mysql php
RussellReal replied to blogfisher's topic in PHP Coding Help
anytime bro, click 'solved' so nobody else here comes and checks dis post out or w\e, so u can save us helpers a lil more time, nah mean. Ty -
[SOLVED] Two tables comparision in mysql php
RussellReal replied to blogfisher's topic in PHP Coding Help
ok.. <?php $q1 = mysql_query("SELECT * FROM `tbl1`"); $q2 = mysql_query("SELECT * FROM `tbl2`"); while ($tbl1 = mysql_fetch_assoc($q1)) { $t1[] = $tbl1; } while ($tbl2 = mysql_fetch_assoc($q1)) { $t2[] = $tbl2; } $lead = ((count($tbl1) <= count($tbl2))? $tbl1:$tbl2); $foll = ((count($tbl1) >= count($tbl2))? $tbl1:$tbl2); for ($i = 0; $i < count($lead); $i++) { for ($k = 0; $k < count($foll); $k++) { if ($lead[$i]['cnt'] > $foll[$i]['cnt']) { do something } } } ?> -
or, you could store the php code, in a temporary file.. example: <?php $d = mysql_fetch_assoc(mysql_query("SELECT `phpdata` FROM `theTable` WHERE `girls` = 'sexy`")); $newphp = fopen('temp.php','w'); fwrite($newphp,$d['phpdata']); fclose($newphp); ob_start(); include('temp.php'); $evaluatedPHP = ob_get_flush(); unlink('temp.php'); ?> however, eval would be much better lol
-
exactly, so if they get the captcha wrong, you generate a NEW captcha image.. I created a captcha image generated a while ago, and I'm not exactly sure how great it is anymore, but its works good.. I've attached it to this post and heres a link to a demo: Image Plain Text from Image [attachment deleted by admin]
-
[SOLVED] Two tables comparision in mysql php
RussellReal replied to blogfisher's topic in PHP Coding Help
SELECT * FROM `tbl1` JOIN `tbl2` ON (tbl1.cnt > tbl2.cnt) WHERE `whatever` = 'whatever' basically this query will grab every row TO BEGIN WITH which tbl1.cnt is greater than tbl2.cnt then, it will proceed with the WHERE clause on that result set. -
sort by id and and do LIMIT 1,1 LIMIT 2,1 LIMIT 3,1 the mysql query would look similar to: SELECT `image_blob` FROM `image_table` ORDER BY `image_id` ASC LIMIT 1,1
-
file_get_contents suddenly not working?
RussellReal replied to opalelement's topic in PHP Coding Help
considering the downtime, you should update the session you're using but this is not a good method to do whatever you're doing, its inefficient.. -
Updating/Altering XML with dynamic structure
RussellReal replied to Swapnil's topic in PHP Coding Help
some attempted code would be nice.. lol, not to be rude, but if you're looking for people to write a script for you, there is a freelance forum where people do exactly that.. but here we help with errors and problems. -
we can't give you directions as to how to echo the data, considering we do not know how flash expects to receive the data.. E.G. XML, CSV.
-
dreamweaver although IDEs aren't really meant to code it for you, its mostly for code hinting and highlighting, but dreamweaver is the primary choice of lazy developers.
-
ok, you don't want to echo all the data to the page for JavaScript to access it, UNTIL the button is pressed I'm assuming? Well, PHP is a server side processor, so basically, once JavaScript is started, PHP is already closed, and all the variables/resources/etc are destroyed and inaccessible.. What you could do, is set up some AJAX and everytime the button is pressed, connect to another php page, which it will still be within the same browser so the session will still be active.. just echo the data of the session into that php and then AJAX will retrieve it and you can play with it all you want once AJAX has it.
-
ahaha thats what I was gonna say!!!
-
try this query mysql_query("SELECT * FROM `forumtutorial_posts` WHERE `parentid` = '0' LIMIT ".(($page - 1) * $tolimit).",4");
-
dude, usually php will shut down after a while.. lol unless you set the timeout to 0