ipwnzphp
-
Posts
129 -
Joined
-
Last visited
Never
Posts posted by ipwnzphp
-
-
I have this script i am coding and it just repeats the checkboxes over and over... i need it to only show the checkboxes for each amentie once and show checked if it is in the database...
<? $result = mysql_query("SELECT * FROM amenties ORDER BY id DESC"); while ($row = mysql_fetch_array($result)) { foreach ($explode_amen as $aman) { if($aman == $row['id']) { $picked = "checked"; } else { $picked = ""; } ?> <div style="float:left; width:210px;"><input name="amen[]" type="checkbox" id="amen[]" style="width:25px;" value="<?=$row['id']?>" <?=$picked?> /><?=$row['amen_name']?></div> <? } } ?>
-
$query='SELECT * FROM table1 LEFT JOIN table2 ON table1.somefield=table2.somefield WHERE table1.somefield=\'value\' ';
$result=mysql_query($query) or die(mysql_error());
if(mysql_num_rows($result)>0){
while($row=mysql_fetch_assoc($result)){
$table[]=$row;
}
}
print_r($table);
would this be what you want? =o
the somefield doesn't need to have the same fieldname in both tables
Still dont understand how to sort it out though into tables of level 1, level 2 and so on until level 5.
-
Let me be more clear..
LEVEL 1 $level_one = mysql_query("select * from users where ref_by = '$username'"); while ($level_one_do = mysql_fetch_array($level_one)) { $level_one_do['Username']; LEVEL 2 $level_one = mysql_query("select * from users where username = '$level_one_do[username]'"); while ($level_one_do = mysql_fetch_array($level_one)) { $level_one_do['Username']; } }
Just some rough code..
-
How i need this code to work is like this
If table 1 show data form mysql for table 1, if table 2 show data for table 2. but the thing is that the data for mysql 2 comes form mysql 1. and so on for 5 times
-
i posted all the code i had!
-
I have a while loop that is making a table 5 times for me. The issue that i am having is i need to run 5 different mysql query's for the 5 different tables that the loop is making for me. How would i go about doing this?
Here is my code
<? $i=1; while ( $i <= 5 ) { ?> <table width="600" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="414" height="35" colspan="5"><strong>Level <?=$i?></strong></td> </tr> <tr> <td height="25"><div align="center">Join Date</div></td> <td><div align="center">Member Name</div></td> <td><div align="center">Username</div></td> <td><div align="center">Free/Pro</div></td> <td><div align="center"></div></td> </tr> <? $level_one = mysql_query("select * from users where ref_by = '$username'"); while ($level_one_do = mysql_fetch_array($level_one)) { $status = $level_one_do['status']; if($status == 1) { $status_type = "Free"; } else { $status_type = "Pro"; } ?> <tr> <td height="35"><div align="center"></div></td> <td height="35"><div align="center"></div></td> <td height="35"><div align="center"> <?=$level_one_do['Username']?> </div></td> <td height="35"><div align="center"></div></td> <td height="35"><div align="center"><img src="images/email_forward-32.png" width="25" height="25"></div></td> </tr> <? } ?> </table> <? $i++; } ?>
-
I have a app that i am working on and it has got me a lil fired up this am!! lol. here is what i am trying to do.
My Issue
I am trying to get the total number of hours worked form the db by adding the start_time and the end_time together.
My Code Snippet
<? $results = mysql_query("SELECT * FROM `simp_time_logger` WHERE p_id = '$id'") or die (mysql_error()); while ($rows = mysql_fetch_array($results)) { $explode_time = explode(" ", $rows['start_time']); $explode_time2 = explode(" ", $rows['end_time']); $start = $explode_time[0]; $end = $explode_time2[0]; $time = $start + $end; } echo $time; ?>
My Error
Says the number of hours worked is 16, How can this be when the start time is 8:29:55 and the end time is 8:29:57
Now the time is stored in the db like this 8:29:55 AM i am using explode to break off the AM/PM form it. I just need it to read the rows of the table and then get the correct total of hours worked to display.
Any help will be greatly appreciated. Thanks!
-
-
This mysql/php data is display twice in the options for the drop down. It should only display the results once and not twice.
<select name="altcaddy2" id="altcaddy2"> {php} $s_id = session_id(); $checkouts = mysql_query("SELECT * FROM `caddie_checkout_storeage` WHERE checkout_session_id = '$s_id'") or die (mysql_error()); while ($get_checkouts = mysql_fetch_array($checkouts)) { $date_id = $get_checkouts['date_id']; $datezs = mysql_query("SELECT * FROM `caddie_schedule` WHERE status='enable' && schedule_id = '$date_id'") or die (mysql_error()); while ($get_datezs = mysql_fetch_array($datezs)) { $datezss = mysql_query("SELECT DISTINCT member_id FROM `caddie_schedule` WHERE status='enable' && start_date = '$get_datezs[start_date]'") or die (mysql_error()); while ($get_datezss = mysql_fetch_array($datezss)) { $caddie_atl = mysql_query("SELECT * FROM `member` WHERE status='enable' && member_id = '$get_datezss[member_id]'") or die (mysql_error()); $get_caddie_atl = mysql_fetch_array($caddie_atl); $caddie_id = $get_caddie_atl['member_id']; {/php} <option value="{php} echo $caddie_id; {/php}">{php} echo $get_caddie_atl['first_name']; {/php}</option> {php} } } } {/php} </select>
Example:
<option value="43">Sooners</option> <option value="44">Emerge</option> <option value="45">Panita</option> <option value="43">Sooners</option> <option value="44">Emerge</option> <option value="45">Panita</option>
Thanks!
-
i'm guessing it's because your assignment of $regdate is failing. have you checked to see what's in $items_pull?
$duedate = $items_pull['age_in_days']; echo $duedate."<br><br>";
Shows things like
733997
733997
733997
733997
733999
733999
734002
733997
733997
733997
and $regdate shows the same thing.
733997
733999
733999
734002
-
It sent an email for every service
Here is my code
require("dbconnect.php"); $hosting_get = mysql_query("SELECT TO_DAYS(nextduedate) AS age_in_days_due, userid, id, billingcycle, username FROM `tblhosting` WHERE domainstatus = 'Active'"); while ($hosting_pull = mysql_fetch_array($hosting_get)) { $userid = $hosting_pull['userid']; $orderid = $hosting_pull['id']; $billingcycle = $hosting_pull['billingcycle']; $regdate =$hosting_pull['age_in_days_due']; $username = $hosting_pull['username']; $items_get = mysql_query("SELECT TO_DAYS(duedate) AS age_in_days FROM `tblinvoiceitems` WHERE relid = '$orderid'"); $items_pull = mysql_fetch_array($items_get); $duedate = $items_pull['age_in_days']; $dodatemath = $regdate - $duedate; if($dodatemath >= 32) { $to = ''; $subject = 'Invoice Aduit Report'; $message = "There is no invoice for ". $username; @mail($to, $subject, $message); } }
-
indeed it should be, provided you have fixed your queries.
Testing once again.. now!
-
let's see if i can guide you through this in simple steps:
1. $regdate holds a value, in days, of `nextduedate` from the table `tblhosting`,
2. once you fix your queries, $duedate will hold a value, in days, of `duedate` from the table `tblinvoiceitems`, and
3. subtracting one of those variables from the other will give the difference, in days, between the two dates.
based on those facts, how do you think you could check whether the difference between those two dates is 32 days or more?
$dodatemath = $regdate - $duedate; if($dodatemath >= 32) { // mail functions here }
That correct?
-
this section:
$hosting_get = mysql_query("SELECT TO_DAYS(nextduedate) AS age_in_days_due FROM `tblhosting` WHERE domainstatus = 'Active'"); while ($hosting_pull = mysql_fetch_array($hosting_get)) { $userid = $hosting_pull['userid']; $orderid = $hosting_pull['id']; $billingcycle = $hosting_pull['billingcycle']; $regdate =$hosting_pull['age_in_days_due']; $username = $hosting_pull['username'];
is flawed. you're not SELECTing anything other than the `age_in_days_due` column, so `userid`, `id`, `billingcycle` and `username` won't be defined. that causes the second query to grab nothing, since $orderid is not defined. add those other columns to the SELECT query.
second, this condition:
if($duedate >= $regdate) {
just checks if the $duedate is greater than or equal than $regdate, with no mention of your 32-day delay.
How would i do the 32 day delay?
-
Still not working, here is my updated code.
require("dbconnect.php"); $hosting_get = mysql_query("SELECT TO_DAYS(nextduedate) AS age_in_days_due FROM `tblhosting` WHERE domainstatus = 'Active'"); while ($hosting_pull = mysql_fetch_array($hosting_get)) { $userid = $hosting_pull['userid']; $orderid = $hosting_pull['id']; $billingcycle = $hosting_pull['billingcycle']; $regdate =$hosting_pull['age_in_days_due']; $username = $hosting_pull['username']; $items_get = mysql_query("SELECT TO_DAYS(duedate) AS age_in_days FROM `tblinvoiceitems` WHERE relid = '$orderid'"); $items_pull = mysql_fetch_array($items_get); $duedate = $items_pull['age_in_days']; if($billingcycle == "Monthly"){ if($duedate >= $regdate) { $to = ''; $subject = 'Invoice Aduit Report'; $message = "There is no invoice for ". $username; @mail($to, $subject, $message; } } }
-
testing now.
-
there has obviously been some miscommunication here. are you looking for the difference between `nextduedate` and `duedate` in number of days?
yes! exactly!
-
Here is my full code, it is still not working.
require("dbconnect.php"); $hosting_get = mysql_query("SELECT (TO_DAYS(NOW()) - TO_DAYS(nextduedate)) AS age_in_days_due FROM `tblhosting` WHERE domainstatus = 'Active'"); while ($hosting_pull = mysql_fetch_array($hosting_get)) { $userid = $hosting_pull['userid']; $orderid = $hosting_pull['id']; $billingcycle = $hosting_pull['billingcycle']; $regdate =$hosting_pull['age_in_days_due']; $username = $hosting_pull['username']; $items_get = mysql_query("SELECT (TO_DAYS(NOW()) - TO_DAYS(duedate)) AS age_in_days FROM `tblinvoiceitems` WHERE relid = '$orderid'"); $items_pull = mysql_fetch_array($items_get); $duedate = $items_pull['age_in_days']; if($billingcycle == "Monthly"){ if($duedate >= $regdate) { $to = ''; $subject = 'Invoice Aduit Report'; $message = "There is no invoice for ". $username; @mail($to, $subject, $message); } } }
-
Trying it now
-
Here is my due date: 2009-08-19
Here is my next due date: 2010-08-18
My dates are stored in same format i posted the dates as.
What it should do, If time between the last invoice and the next due date is greater than or equal to. It should email me!
$datedff = ""; what goes here? if($datedff >= "32") { $to = ''; $subject = 'Invoice Aduit Report'; $message = "There is no invoice for ". $username; @mail($to, $subject, $message, $headers); }
-
billing system
-
well i know this but WHMCS are idots.
-
is how it is stored in the database 58a9eeb60f1f6500a93a1bf494dec24c:voc)N
So how are they getting 4d75fa2015aabf5620c050a85321bf27 for the users password when logging?
-
Post your code.
P.S. It seems PHP is pwning you more then you PHP
$sds = $results["password"];
$sd = explode(":", $sds);
$hash = $sd[1];
$pass = "123456";
echo md5($hash.$pass);
Help: Stop Foreach Looping
in PHP Coding Help
Posted
Thanks! worked like a champ!!