taquitosensei
Members-
Posts
676 -
Joined
-
Last visited
-
Days Won
2
Everything posted by taquitosensei
-
This isn't the problem but...you don't need the "== true" this will work. if($checkLink) the problem is... you've got your needle and haystack backwards you're looking for a haystack in the needle.
-
[SOLVED] Countdown to first tuesday of every month.
taquitosensei replied to TRemmie's topic in PHP Coding Help
try this instead $thistues=strtotime("first tuesday",strtotime(date("Y-m"))); $today=strtotime(date("Y-m-d")); $nexttues=($today>=$thistues)?strtotime("first tuesday", strtotime("+ 1 Month", strtotime(date("Y-m")))):$thistues; $seconds=($nexttues-$today); $minutes=($seconds/60); $hours=($minutes/60); $days=($hours/24); echo "There are ".floor($days)." days left until next tuesday"; -
[SOLVED] code works but reports errors??
taquitosensei replied to mike12255's topic in PHP Coding Help
It's not OOP at all. It's just good practice for readability and avoiding giant headaches in the future. -
[SOLVED] code works but reports errors??
taquitosensei replied to mike12255's topic in PHP Coding Help
you're changing the value of $res from the database result to a row from the database change this $res = mysql_query($sql) or die (mysql_error()); while ($res = mysql_fetch_array($res)){ to [php $res = mysql_query($sql) or die (mysql_error()); while ($row = mysql_fetch_array($res)){ echo $row['lname'] . " " .$row['fname'] . " " . $row['comment'] ; } [/code] you do this several times. For each resultset use a different variable. example $sql_petition = "SELECT * FROM petition WHERE ip = '$ip'"; $res_petition = mysql_query($sql_petition) or die (mysql_error()); $sql_petition_cnt = "SELECT COUNT(*) AS CNT FROM petition"; $res_petition_cnt = mysql_query($sql_petition_cnt); $sql_name = "SELECT fname,lname,comment FROM petition ORDER BY lname DESC"; $res_name = mysql_query($sql_name) or die (mysql_error()); // etc also make sure to update the loops accordingly -
Post your code. Don't tell us what it does or what you want it do. We can't help unless you reply to this post put [ php ] without the spaces copy and paste your code here [ /php ] with out the spaces click post
-
just create a text file called php.ini with the above as it's only contents and place that in your root directory. That should overwrite that one setting from the hosts php.ini for php scripts called from all folders above it.
-
are you on windows/linux? what text editor are you using? You'll have to give us more info.
-
usually with shared hosts you can do a custom php.ini in your root folder. Then use that to specify the location of the browscap.ini file./ like so [browscap] browscap = /full/path/to/browscap.ini
-
[SOLVED] Countdown to first tuesday of every month.
taquitosensei replied to TRemmie's topic in PHP Coding Help
this would be it roughly and I think you might have trouble if you're dealing with a non standard timestamps or timezone outside of the US time zones. $thistues=strtotime("first tuesday"); $today=strtotime(date("Y-m-d")); $nexttues=($today<$thistues)?$thistues:date("Y-m-d", strtotime("first tuesday", strtotime("+ 1 Month", strtotime(date("Y-m")))));; $seconds=($nexttues-$today); $minutes=($seconds/60); $hours=($minutes/60); $days=($hours/24); echo "There are ".$days." days left until next tuesday"; -
where do you actually do your querying of the database? Because that's where you'd do this. select columns from table where datefield >= today
-
with the way you've got it you're missing some quotes and some concatenation and the keys for $row, and a couple of equals $accept = "UPDATE requests2 SET `status` = '".$status."', `resp_name` = (SELECT `name` FROM `users` WHERE `uid` = '".$row['resp_uid']."'), `resp_organization` = (SELECT `organization` FROM `users` WHERE `uid` = '".$row['resp_uid']."'), `resp_email` = (SELECT `email` FROM `users` WHERE `uid` = '".$row['resp_uid']."'), `resp_phone` = (SELECT `phone` FROM `users` WHERE `uid` = '".$row['resp_uid']."'), `resp_url`= (SELECT `email` FROM `users` WHERE `uid` = '".$row['resp_uid']."'), `resp_im` = (SELECT `im` FROM users WHERE `uid` = '".$row['resp_uid']."'), `resp_address` = (SELECT `address` FROM `users` WHERE `uid` = '".$row['resp_uid']."')"; But...I would use a join for the first query $getresp = " SELECT users.name, users.organization, users.email, users.phone, users.email as url, users.im, users.address FROM requests JOIN users on requests.resp_uid=users.uid WHERE resp_uid.request = '$req' "; then $result = mysql_query($getresp) or die(mysql_error()); while($row=mysql_fetch_array($result)) { $accept="UPDATE requests2 SET `status` = '".$status."', `resp_name` = '".$row['name']."'), `resp_organization` = '".$row['organization']."', `resp_email` = '".$row['email']."', `resp_phone` = '".$row['phone']."', `resp_url`='".$row['url']."', `resp_im` = '".$row['im']."', `resp_address` = '".$row."' where uid='".$row['uid']; } you'll need to double check me, some of the column names and keys might be wrong.
-
Use a join then alter your html to show the minutes field from table2 . $rs=mysql_query("select * from tbl1 JOIN tbl2 on tbl1.id=tbl2.mid ORDER BY date DESC"); while($row=mysql_fetch_row($rs)){ $date = $row[3]; $row[3] = strtotime($date); $row[3] = date('M. d, Y', $row[3]); foreach ($row as $k => $v){ $row[$k] = nl2br($v); } echo("<tr><td>" . $row[1] . "</td>"); echo("<td>" . $row[3] . "</td>"); echo("<td>" . $row[2] . "</td>"); echo("<td>" . $row[4] . "</td>"); if($row[5]!="") { echo("<td><a href='agenda/" . $row[5] . "' target='_new'>View</a></td></tr>"); } else { echo("<td>N/A</td></tr>"); } } ?>
-
so talking mathematical functions not php functions? Do I have that right?
-
you first query would do that $query = " SELECT admin_id, server_id, nickname, hostname FROM amx_amxadmins a, amx_serverinfo s, amx_admins_servers c WHERE c.admin_id = a.id AND c.server_id = s.id AND a.id = c.admin_id"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){ $nicks[$row['nickname']][]=$row['server_id']; } then foreach($nicks as $nickname=>$serverids) { echo $nickname." ".implode(" ",$serverids); }
-
something like this $query = " SELECT admin_id, server_id, nickname, hostname FROM amx_amxadmins a, amx_serverinfo s, amx_admins_servers c WHERE c.admin_id = a.id AND c.server_id = s.id AND a.id = c.admin_id"; $result = mysql_query($query) or die(mysql_error()); $oldnick=""; while($row = mysql_fetch_array($result)){ echo ($oldnick!=$row['nickname'])?"<br>".$row['nickname']:$row['server_id']." "; $oldnick=$row['nickname']; }
-
how about a hidden field <input type="hidden" name="yourpostname" value="<?php echo (isset($_POST['yourpostname']))?$_POST['yourpostname']:""; ?>"> then you'll have that post available in the second post
-
it's because $results isn't defined yet. here's how I would do this function getResults($db,$masterQuery){ $results=False; $query = $db->query($masterQuery); //we have a result while($row=$db->fetchArray($query)){$results[] = $row;} @mysql_free_result($query); } return $results; } Then you can just check for results on the next page and if it's true do whatever you need to do.
-
if you're using apache. look into mod rewrite http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
-
You're overthinking this and making it way too complicated. Just have one submit at the bottom. Let them change whatever they want. Update everything. If a value hasn't changed then it updates it with what it already was. If the value has changed it updates with the new value.
-
what did you put in your htaccess file because this php_flag allow_url_include 0 should work
-
that's what $numbers is in his example $list="4,8,15,16,23,42"; $numbers=explode("," $list);
-
first use php or code tags. Makes it much easier to read. and try something along these lines. $a=0; while($row=mysql_fetch_array) { $checked=($a==0 || (isset($_POST['replacement']) && $_POST['replacement']==$row['date']))?"checked":""; ?> <td><input name="replacement" type="radio" value="<?php echo $row['date']; echo $row['title']; ?>" <?php echo $checked; ?>></td> <td><?php echo $row['title']; ?></td> <td><?php echo date('d-m-Y',strtotime($row['date']));?></td> <td><?php echo $row['entitlement']; ?></td> <td><?php echo $left; ?></td> <td><?php echo $row['validity']; ?></td> </tr><? }
-
This is more of a css html question than php.
-
Array and Exploding Not Outputting Correctly
taquitosensei replied to silveradogirl45's topic in PHP Coding Help
Try this $result = mysql_query("SELECT column1 from Table); while ($row = mysql_fetch_array($result)) { $cars[]=$row['column1']; } print_r($cars);