-
Posts
760 -
Joined
-
Last visited
Posts posted by joel24
-
-
set the default timezone to europe/london or whichever timezone you're in.
put this line at the very top of the script
date_default_timezone_set('Europe/London');
-
seems your server's timezone is set to somewhere around the u.s.a.
do this to check
echo date('e'); exit();
to set your timezone, use date_default_timezone_set()
a list of timezones are here
i.e.
//using server's timezone echo date('e g:ia d/m/y', 1288393200) . '<br/>'; //change to london date_default_timezone_set('Europe/London'); //same command using london timezone. echo date("e d/m/y g:ia", 1288393200); exit();
-
it is a timestamp.
the time/date (g:ia d/m/y) from that timestamp is 10:00am 30/10/10
if that is not the anticipated date/time, you'll have to have a look at how the timestamps are being inserted into the database.
-
but what does $row_events['event_date'] echo by itself?
change the line
<? echo ($row_events['event_date']==""?$row_events['event_name']:date ("D, j F y", $row_events['event_date'])) ; ?>
to
exit("<p>Value: ".$row_events['event_date']).'</p>';
and post whatever value it prints
-
Any idea how to do this?
all depends on what $row_events['event_date'] returns (format)
echo $row_events['event_date']; and post it here.
-
what value does $row_events['event_date'] return?
-
In the database the date is in putted as 2010-10-30.
...
date ("D, j F y", $row_events['event_date']))
the date function takes unix timestamps as its second operator, not a formatted date.
if date("c") is returning the wrong date, then it would seem your server is set in a different timezone?
http://www.php.net/manual/en/function.date-default-timezone-set.php
or
//timezone php. change australia/sydney to your timezone as listed on the PHP.net site putenv('TZ=Australia/Sydney');
-
for the query function in the class I would have the input to be
function Query($query, $where, $extra) { //rarrararara $sql = "$query $where $extra"; //execute and return results }
then to call it
$do->Query("SELECT * FROM users", "WHERE id=1", "LIMIT 1");
-
does your password contain any special characters?
$, @, # etc?
-
I don't want the while loop to run if num_rows is greater than 0, but it does and I'm sure it shouldn't be.
then what's the point of having a loop?
you're missing the () after num_rows
if ($result->num_rows() > 0){
-
you already have an update query in the code...?
$sql = "UPDATE settings SET site_name='$site_name', description='$description', keywords='$keywords', email='$site_email', name='$your_name' WHERE id='$id'";
have a look at some mysql/php tutorials. You'll need to do a select query and then echo the results.
-
-
you're missing a $ infront of $_POST['username']... you just have _POST['username']
if (!$_POST['id'] | !_POST['userName'] | !$_POST['passWord'] | !$_POST['confpassWord'] | !$_POST['email'] ) {
-
are you trying to set the primary key on the insert query? or is it an automatically incrementing field?
-
-
Is selecting an option relevant to the grow of the website or it is?
Yes, if you suspect the website will grow large then you'll want the payments automated, it will be quite time consuming to send out payments manually... and also opens up the risk of human error. Paypal API allows you to make payments automatically with your script
The other option is to automatically generate invoices and send these to companies, however then you'll need to either monitor the incoming payments or once again set up your payments applications API to monitor incoming transactions etc etc.
Someone else might be able to offer some greater insight, I'm a novice when it comes to automated payments
-
the mysql IN conditions need to be enclosed in brackets, surrounded by ' if they are strings (no need for integers) and then separated by ,
i.e.
SELECT FROM tables WHERE field IN ('first', 'second', 32, 58)
as for the error with the implode function, is $user_id an array?
-
you're not closing the <span> tag which sets the text to #FF0000
if(count($errors)>0) { $errorText .= "<span style=\"color:#ff0000;\">"; $errorText .= "De volgende fout(en) zijn opgetreden:<ul>\n"; foreach($errors as $errorMsg) { $errorText .= "<li>$errorMsg</li>"; } $errorText .= "</ul></span>" //was span style=\"color:#ff0000;\"; }
-
-
1. the table displays the entire contents of the db before it is filtered through the search, I think this has something to do with the $num=mysql_numrows($result); expression, but I'm not sure how to fix it
% is a wildcard in mysql queries, i.e. WHERE surname LIKE '%a%' will search for anything with a in it. Whilst WHERE surname LIKE 'a%' (like in your code) will search for anything starting with the letter a. In your code you have where SURNAME like '$_POST['name']%'... searching for anything that starts with the form posted surname.
Try put this bit of code underneath the $query= line and then you'll be able to see all the values posted from the form and the mysql search string you are generating and then diagnose the problem.
print_r($_POST); echo $query; exit();
2. I'd like the last column of the table to be about twice as wide as the others, as it contains a lot of free text, would I have to set the length of each column in order to do this or is there a shorthand way?
set the width of the last column using CSS and the others will still have automatic widths set. Shorthand way, you only need to set the width of one cell in the column and all others will follow suit.
-
for the redirecting, use php's header() function and then exit(); when you want to redirect the user... in your case after the email script
header('Location: http://www.yourDomain.com'); exit();
if you want an error or success message, you can redirect to a success or error page or send the error/success in the url with $_GET ... or you could also send it via a session but I wouldn't for a public page.
And as for the $_GET error/success
And now for the form validation, you can use isset() to ensure that a variable is set
if (isset($_POST['email'])) { echo "it is set"; } // exclamation point reverses condition if (!isset($_POST['email'])) { echo "email is not set. Error"; }
that should get you started...
-
surround the new value of the variable in brackets, and also you don't need the square brackets around T in the date function.
i.e.
class Settings { public static $mysql_datetime_format = ("%c/%e/%Y %l:%i %p " . date("T")); }
-
increment is done with ++
in a loop, $count++; would increment $count + 1 for each loop.
function wp_rss( $url, $num_items = -1 ) { if ( $rss = fetch_rss( $url ) ) { echo '<div id="charts">'; if ( $num_items !== -1 ) { $rss->items = array_slice( $rss->items, 0, $num_items ); } //start count $i = 1; foreach ( (array) $rss->items as $item ) { printf( '<div id="chart_lt">'.$i.'</div><div id="chart_rt">%3$s</div>', esc_url( $item['link'] ), esc_attr( strip_tags( $item['description'] ) ), htmlentities( $item['title'] ) ); //increment $i++; } echo '</div>'; } else { _e( 'An error has occurred, which probably means the feed is down. Try again later.' ); } }
-
sorry, mixed up a with y.
$data = mysql_query("SELECT y.*, (SELECT COUNT(posts) FROM YBK_Ads a WHERE a.UID = y.UID) AS postCount FROM YBK_Login y") or die(mysql_error()); while($info = mysql_fetch_array( $data )) { Print "<tr>"; Print "<td>".$info['postCount'] . " </td>";Print "<td>".$info['UID'] . " </td>";Print "<td>"."#"."</td>";Print "<td>".$info['ID'] . "</td> "; Print "<td>".$info['Allowed'] . "</td> ";Print "<td>".$info['pass'] . " </td>";Print "<td>".$info['HR'] . " </td>"; } ?>
Warning: Invalid argument supplied for foreach()
in PHP Coding Help
Posted
commented next to modifications. starts at line 181