billy_111
-
Posts
96 -
Joined
-
Last visited
Never
Posts posted by billy_111
-
-
hi,
I need to put together the following:
http://www.freemanholland.com/cow/homepage.jpg
I eventually need to be able to administer the images in the back-end but for now i just want to put it together..
The page will remain the same in terms of layout, the images wrapper will be elastic so it spreads across the screen.. I had a go at doing it with one image:
http://www.freemanholland.com/cow/public_html/
But i need to have the page looking like the image i have provided above..
How can i do this?
Thanks
-
Hi,
I have a problem and can't seem to figure out how to do it..
Basically i have these 2 tables:
PeoplePid
Pname
Pdateadded
Pdeleted
And..
Quote:PeopleCon
PCid
Pid
PCorder
Pdateadded
Pdeleted
Now, currently i insert the data into a table "People".. like you guys have helped me with..
But what i need to do is, first check to see if the author already exists in the People table, if so then just INSERT into PeopleCon, ELSE INSERT into both People and PeopleCon...
Also if there are 4 authors, and 2 exist in People, and 2 do not. What needs to happen is the first 2 are simply inserted into PeopleCon, but the last 2 are INSERTED into both People and PeopleCon. When the authors are inserted into PeopleCon, the PCorder row needs to increment by the number of authors byt order of author.
So this is the logic:
[*]Multiple authors are entered in textboxes
[*]Fire the script
[*]Check to see if author already exists in "People" table
[*]IF it does exist, INSERT into PeopleCon table
[*]ELSE do the insert into the People AND PeopleCon table, first it will INSERT into the People, and GET the MAX (ID) and insert into the PeopleCon
So i currently have this, but as 3 separate methods:
class People {
public function checkNameExists(){
$query = "SELECT * FROM People WHERE Pname = '". mysql_real_escape_string($_POST['author'])."'";
$result = mysql_query($query);
if(mysql_num_rows($result) > 0):
$row = mysql_fetch_array($result);
return true;
else:
return false;
endif;
}
public function insertAuthor(){
$callback = create_function('$author','return "(\'".mysql_real_escape_string($author)."\',NOW(),0)";');
$sql = sprintf(
'INSERT INTO People (Pname, Pdateadded, Pdeleted) VALUES %s'
,implode(',',array_map($callback,$_POST['author']))
);
$result = mysql_query($sql);
return "Successfully added NEW author";
}
public function insertAuthorCon(){
$sql = "INSERT INTO PeopleCon
(Pid, PCorder, PCdateadded, PCdeleted) VALUES
(
'MAX ID WILL GO HERE',
'INCREMENT OF ORDER GOES HERE',
now(),
0
)";
$result = mysql_query($sql);
return "Successfully added existing author";
}
But obviously i need to combine these together into one method to match what i am trying to achieve..
Can anyone point me in the right direction?
Thanks again...
-
I have tried getting something working with jQuery but what is happening it adds the wrong text box:
http://www.prima.cse.salford.ac.uk:8080/~ibrarhussain/test.html
If you click on "Add author" it adds the "Title" text box instead of adding the "Author" text box.. Any ideas how i can fix this?
Will this method be practical when i want to add/update the values in the database?
Thanks
-
Hi,
Is there a way i could have a text input box and when a user types something inside and clicks off it, a new textbox appears just underneath? It doesn't just have to appear, it may be good to have a link saying "add new..." and then on clicking this it show s anew text box.
But firstly is this possible? I want to apply it to this:
http://www.prima.cse.salford.ac.uk:8080/~ibrarhussain/patent.jpg
Just underneath the "file upload" box. I want to insert the values of each textbox into a database, there will be no limit as to how many textboxes appear..
Can anyone help?
Thanks
-
Hey,
I have the following class:
<?php class Gallery{ public function selectGalleryCategories(){ $sql = "SELECT * FROM tbl_gallerycategories"; $result = mysql_query($sql); return $result; } }
When i try using "include('classes/Galleries.class.php');" i get an error:
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /homepages/27/d208312252/htdocs/fusion/admin/classes/Galleries.class.php on line 5
Line 5 is this:
public function selectGalleryCategories(){
Any idea what the problem is?
Thanks
-
Hi,
I am driving myself mad with getting this to work. Basically i have a page see below:
http://freemanholland.com/babies/your-recommendations/
You will need to login via the link in the "SIGN UP FREE TODAY!" box at the top, with joe@hotmail.com, and password.
Thought i would create a test account so you can see exactly what the problem is.
So you will see a series of recommendations, and on the right of each a box which either allows the user to like the recommendation view or see that they already like the recommendation...
What i need to do is check to see if the CURRENT person who is logged in likes the recommendation. But it does not work..
I have the following method:
public function selectAllApprovedRecommendations(){ $sql = "SELECT r.ID as theID, r.title, r.review, r.date_added as theDate, m.fname, m.sname, COUNT(h.RID) AS HITS, h.UID as theUser FROM tbl_recommendations r LEFT JOIN tbl_members m ON r.UID = m.ID LEFT JOIN tbl_recommendationshits h ON r.ID = h.RID WHERE r.deleted = 0 AND r.approved = 1 AND m.deleted = 0 GROUP BY r.ID, r.title, r.review, r.date_added, m.fname, m.sname ORDER BY r.date_added DESC"; $result = mysql_query($sql); return $result; }
Now i try to check to see if the SESSION['ID'] is the same as $hits['theUser'], if so show a message, if not show the box which allows users to click to love the recommendation..
<? $bubbles = Recommendations::selectAllApprovedRecommendations(); $i = 0; while($row = mysql_fetch_array($bubbles)){ $date = $row['theDate']; $date = strtotime($date); $thedate = date("M d, Y \at h:i:s a",$date); ?> <div class="recommendation-bubble-wrap"> <div class="right"> <? if($row['HITS'] == 0){ ?> <form method="post" action=""> <input type="submit" name="updatehits" id="updatehits" class="hits" value=""/> <input type="hidden" name="ID" value="<?=$row['theID']?>" /> </form> <? } else { if($row['theUser'] != $_SESSION['ID']){ ?> <form method="post" action=""> <input type="submit" name="updatehits" id="updatehits" class="hits" value=""/> <input type="hidden" name="ID" value="<?=$row['theID']?>" /> </form> <? } else { ?> <div class="youlikethis"><strong>You like this review</strong></div> <? } }?> </div> <div class="recommendation-bubbles<?=$i?>"> <div class="right heart"> <img src="http://<?=$_SERVER['SERVER_NAME'].$sitename?>images/heart.png" alt=""> <?=$row['HITS']?> people love this too </div> <p><?=$row['fname'].' '.$row['sname']?> wants to recommend a <strong> <?=$row['title']?></strong></p> <strong><?=$thedate?></strong> <div class="recommendation-text"><?=$row['review']?></div> </div> </div> <? $i++; $i = $i % 2; } ?>
But it works only when one users likes a recommendation, when a different user is logged in then it shows the button regardless of whether the user has already clicked it..
This is my table structure:
tbl_recommendationsID (Auto Inc)
UID (User ID)
title
review
date_added
tbl_recommendationshitsID (Auto Inc)
RID (Review ID)
UID (User ID)
date_added
I'm confused as to why it won't work
-
I have even tried doing this:
mail('ibrar@freemanholland.com', 'test', 'TEST');
And it does not send an email..
Where could the problem be?
-
I realised that the email was being sent but not to certain email accounts.
This is my new code:
$from = "dontreply@glofamily.com"; $headers = "From: $from"; $to = "ibrar@freemanholland.com"; $subject = "New registration Glo Family website"; //begin of HTML message $message = <<<EOF <html> <body> <div style='background:#e1e1e1; padding:10px'> <h3>New Member Registration</h3> <br> <table> <tr> <td>Name:</td><td>$_POST[name]</td></tr> <tr> <td>Address 1:</td><td>$_POST[address_1]</td> </tr> <tr> <td>Address 2:</td><td>$_POST[address_2]</td> </tr> <tr> <td>Postcode:</td><td>$_POST[postcode]</td> </tr> <tr> <td>Email address:</td><td>$_POST[email]</td> </tr> <tr> <td>Tel no - home:</td><td>$_POST[tel_home]</td> </tr> <tr> <td>Tel no - work:</td><td>$_POST[tel_work]</td> </tr> <tr> <td>Tel no - mobile:</td><td>$_POST[tel_mobile]</td> </tr> <tr> <td>Date of Birth:</td><td>$_POST[DOB]</td> </tr> <tr> <td>Delivery date (if appropriate):</td><td>$_POST[delivery]</td></tr> </table> <br/> <table> <tr> <td>Name of other adults:</td><td>Postcode</td> </tr> </table> </div> <br> <b>glofamily.com</b> <br><br> <i>p.s. please do not reply to this email.</i> </body> </html> EOF; //end of message $headers = "From: $from\r\n"; $headers .= "Content-type: text/html\r\n"; $headers .= "Cc: ibrar_hussain_19@hotmail.co.uk"; mail($to, $subject, $message, $headers);
Now the email is being sent to the @hotmail.co.uk account, but not to the @freemanholland.com account. The email is being sent but i dont know why i don't receive it on the other account..
What could be the cause of this? The @freemanholland.com account is a work email, which i am using for testing purposes, we actually set up webmail for clients through work, the email i will send this to when ig et it working if info@glofamily.com..
As the info@account will be on the same server as the @Freemanholland account i think i will have the same problem..
How can i resolve this, it's stupid that it sends to one and not the other..
Thanks
-
Hey,
Does anyone know why this email script does not send an email? It does not give me any errors but the email does not send..
This is the code:
<?php $message = ''; if(isset($_POST['submit'])){ if(isset($_POST['tick'])){ $tick = "No"; } else { $tick = "Yes"; } if($_POST['name'] != "" && $_POST['address_1'] != "" && $_POST['postcode'] != "" && $_POST['email'] != "" && $_POST['tel_mobile'] != "" && $_POST['DOB'] != "" && $_POST['dietary'] != ""){ // Send email to info @ $msg = "<h3>New Member Registration</h3> <table> <tr> <td>Name:</td><td>".$_POST['name']."</td></tr> <tr> <td>Address 1:</td><td>".$_POST['address_1']."</td> </tr> <tr> <td>Address 2:</td><td>".$_POST['address_2']."</td> </tr> <tr> <td>Postcode:</td><td>".$_POST['postcode']."</td> </tr> <tr> <td>Email address:</td><td>".$_POST['email']."</td> </tr> <tr> <td>Tel no - home:</td><td>".$_POST['tel_home']."</td> </tr> <tr> <td>Tel no - work:</td><td>".$_POST['tel_work']."</td> </tr> <tr> <td>Tel no - mobile:</td><td>".$_POST['tel_mobile']."</td> </tr> <tr> <td>Date of Birth:</td><td>".$_POST['DOB']."</td> </tr> <tr> <td>Delivery date (if appropriate):</td><td>".$_POST['delivery']."</td></tr> </table> <br/> <table> <tr> <td>Name of other adults:</td><td>Postcode</td> </tr> <tr> <td>".$_POST['name_adult_1']."</td><td>".$_POST['adult_postcode_1']."</td> </tr> <tr> <td>".$_POST['name_adult_2']."</td><td>".$_POST['adult_postcode_2']."</td></tr> </table> <br/> <table> <tr> <td>Name of child:</td><td>Date of Birth</td><td>Boy/Girl</td> </tr> <tr> <td>".$_POST['name_child_1']."</td><td>".$_POST['child_dob_1']."</td><td>".$_POST['child_boy_1']."</td></tr> <td>".$_POST['name_child_2']."</td><td>".$_POST['child_dob_2']."</td><td>".$_POST['child_boy_2']."</td></tr> <td>".$_POST['name_child_3']."</td><td>".$_POST['child_dob_3']."</td><td>".$_POST['child_boy_3']."</td></tr> <td>".$_POST['name_child_4']."</td><td>".$_POST['child_dob_4']."</td><td>".$_POST['child_boy_4']."</td></tr> <td>".$_POST['name_child_5']."</td><td>".$_POST['child_dob_5']."</td><td>".$_POST['child_boy_5']."</td></tr> <td>".$_POST['name_child_6']."</td><td>".$_POST['child_dob_6']."</td><td>".$_POST['child_boy_6']."</td></tr> </table> <br/> <table> <tr> <td>Do any of the persons listed above have specific dietary requirements?</td><td>".$_POST['dietary']."</td> </tr> <tr> <td>How did you hear about Glo Family</td> <td>".$_POST['hear']."</td> </tr> </table> <br/> <table> <tr> <td>How did you hear about Glo Family</td> <td>".$tick."</td> </tr> </table> "; $to = "ibrar@freemanholland.com"; $from = "noreply@glofamily.com"; $subject = "New registration Glo Family website"; $headers = "From: $from\r\n"; $headers .= "Content-type: text/html\r\n"; mail($to, $subject, $msg, $headers); } else { $message = "<div class='error'>Please fill in all required * fields.</div>"; } } ?>
Am i doing something wrong?
Thanks
Regards
Billy
-
Hey,
I have the following update statement:
public function updateReviews(){ if(is_numeric($_POST['ID'])){ $body = mysql_real_escape_string($_POST['body']); $body = str_replace(''', '', $body); $address = mysql_real_escape_string($_POST['address']); $other = mysql_real_escape_string($_POST['other']); $admission = mysql_real_escape_string(htmlentities($_POST['admission'])); $sql = "UPDATE tbl_reviews SET catID = '".mysql_real_escape_string($_POST['catID'])."', title = '".mysql_real_escape_string($_POST['title'])."', body = '$body', address = '$address', postcode = '".mysql_real_escape_string($_POST['postcode'])."', tel = '".mysql_real_escape_string($_POST['tel'])."', website = '".mysql_real_escape_string($_POST['website'])."', admission = '$admission', other = '$other', date_added = now() WHERE ID = ".$_POST['ID'].""; print_r(mysql_error()); $result = mysql_query($sql) or die(mysql_error()); return $result; }else{ die('ID needs to be numeric'); } }
When i run this this line does not really work:
$body = str_replace(''', '', $body);
If you look at this page:
http://freemanholland.com/babies/reviews/?ID=9
And look at the "Smithills Country Park" review, you will see that where there should be an apostrophe it shows the word like this:
you\\\'reAny ideas why this is?
Thanks
-
I don't get no errors, nothing at all..
That's why i am confused, it's simply not extracting the contents of the ZIP file..
What do you think?
-
Hey,
I'm trying to have a crack at some code i have bee following, don't know if this is in any way correct :-) but lets see what you guys think. So i need to upload and extract the contents of a ZIP file to a folder on the server called "reviewimages"..
This is my method:
public function UploadZIPFileToServer(){ move_uploaded_file($_FILES["zipfile"]["tmp_name"], "../reviewimages/" . $_FILES["zipfile"]["name"]); if(is_uploaded_file($_FILES['zipfile']['tmp_name'])){ $zipfilename = basename($_FILES['zipfile']['name']); $zip = zip_open($zipfilename); if ($zip) { while ($zip_entry = zip_read($zip)) { $fp = fopen($targetdir . zip_entry_name($zip_entry), "w"); if (zip_entry_open($zip, $zip_entry, "r")) { $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)); fwrite($fp,"$buf"); zip_entry_close($zip_entry); fclose($fp); } } } zip_close($zip); } }
And this is how i fire the method:
if(isset($_POST['uploadZIP'])){ $message = Review::UploadZIPFileToServer(); echo '<script type="text/javascript">window.location = "http://'.$_SERVER['SERVER_NAME'].$sitename.'manage-reviews.php"</script>'; } <form enctype="multipart/form-data" action="" method="post" id="add-courses"> <table> <tr> <td class="width"><label for="image">Upload ZIP file : </label></td> <td><input type="hidden" name="MAX_FILE_SIZE" value="1000000000000" /><input type="file" name="zipfile" id="zipfile" value=""/></td> <td><input type="submit" name="uploadZIP" value="Upload" /></td> </tr> </table> </form>
This uploads the ZIP file to the server into the "reviewimages" folder, but i need it to extract its contents which it does not do.. Any ideas?
Thanks
Billy
-
I have just tried adding this:
$body = preg_replace("/[^\x9\xA\xD\x20-\x7F]/", "", $body);
And it has inserted the data but removed apostrophes totally, so it displays "It's" as "Its"..
Which is not right..
Any ideas?
-
For some reason my post code has not come out properly, this section has been posted again..
$body = $items[2];
$body = str_replace('Ô', ''', $body); // O symbol
$body = str_replace('Õ', ''', $body); // O symbol
$body = str_replace('Ð', '', $body); // D symbol
$body = str_replace('Ž', 'e', $body); // Z symbol
$body = mysql_real_escape_string(htmlentities($body));
-
Hey,
I am trying to upload a CSV file and also convert the weird symbols to their correct english format. But it does not seem to work, the CSV file successfully inserts the data, but i can't seem to get the str_replace to work..
This is the code:
public function InsertCSVFileToDB(){ $has_title_row = true; $not_done = array(); if(is_uploaded_file($_FILES['csvfile']['tmp_name'])){ $filename = basename($_FILES['csvfile']['name']); if(substr($filename, -3) == 'csv'){ $tmpfile = $_FILES['csvfile']['tmp_name']; if (($fh = fopen($tmpfile, "r")) !== FALSE) { $i = 0; while (($items = fgetcsv($fh, 10000, ",")) !== FALSE) { if($has_title_row === true && $i == 0){ // skip the first row if there is a tile row in CSV file $i++; continue; } $body = $items[2]; $body = str_replace('Ô', ''', $body); // O symbol $body = str_replace('Õ', ''', $body); // O symbol $body = str_replace('Ð', '', $body); // D symbol $body = str_replace('Ž', 'f', $body); // Z symbol $body = mysql_real_escape_string(htmlentities($body)); $sql = "INSERT INTO tbl_reviews SET catID='{$items[0]}', title= '" . mysql_real_escape_string(htmlentities($items1])) . "', body = '$body', address= '" . mysql_real_escape_string(htmlentities($items[3])) . "', postcode='" . mysql_real_escape_string(htmlentities($items[4])) . "', tel='" . mysql_real_escape_string(htmlentities($items[5])) . "', website='" . mysql_real_escape_string(htmlentities($items[6])) . "', admission='" . mysql_real_escape_string(htmlentities($items[7])) . "', other='" . mysql_real_escape_string(htmlentities($items[8])) . "', image1='" . mysql_real_escape_string(htmlentities($items[9])) . "', image2='" . mysql_real_escape_string(htmlentities($items[10])) . "', image3='" . mysql_real_escape_string(htmlentities($items[11])) . "', image4='" . mysql_real_escape_string(htmlentities($items[12])) . "', date_added = now()"; if(!mysql_query($sql)){ $not_done[] = $items; } $i++; } } // if there are any not done records found: if(!empty($not_done)){ echo "<strong>There are some records could not be inserted</strong><br />"; print_r($not_done); } } else{ die('Invalid file format uploaded. Please upload CSV.'); } } else{ die('Please upload a CSV file.'); } }
However the text appears like this:
http://freemanholland.com/babies/reviews/?ID=8
Scroll down to the "Imperial War Museum North" review and you will notice many weird symbols..
Any ideas why it does not work?
Thanks
Kind regards
Billy
-
Can anyone see why this is happening?
-
Thank you so much!
That worked perfectly..
Thanks again
-
Hey,
Take a look at this page:
http://www.freemanholland.com/babies/
I have 2 Divs 'sign-up' and 'sign-up-two' and i use Javascript to display each one depending on the clicking of a link.
Now When you click on "Already a member? Click here to login", You will see a login box. When you submit the form the page reloads. I want the box to remain showing the login form..
I tried doing this:
<? if(isset($_POST['register'])){ ?> <script type="text/javascript" language="javascript"> document.getElementById('sign-up').style.display='none'; document.getElementById('sign-up-two').style.display='block'; </script> <? if(isset($_POST['email']) && $_POST['email'] != '' && isset($_POST['password']) && $_POST['password'] != '') { if(User::AuthenticateSiteUser()){ }else{ $error = "<div class=\"error\">Email or Password incorrect.</div>"; } } } ?>
But it didn't work..
Any ideas how i can do this??
Thanks again
Billy
-
Hey,
Take a look at this page:
You will notice a slider, however when you press ctrl f5 the slider disappears.., on some browsers IE7/8 when the page first loads the slider does not appear.. i have to then refresh the page and it works again..
Seems really weird..
This is what i see when the problem occurs:
http://www.glofamily.com/glo/error.jpg
Any ideas what the problem is?
Thanks again
Billy
-
Hey,
I managed to get it working like so:
$recWeeks = mysql_real_escape_string($_POST['recWeeks']); for($i=0; $i<$recWeeks; $i++){ $sql = "INSERT INTO tbl_courses (catID, locID, weeks, date, startdate, enddate, title, body, email, practitioner, phone, image, date_added) VALUES ( '".mysql_real_escape_string($_POST['catID'])."', '".mysql_real_escape_string($_POST['locID'])."', '".mysql_real_escape_string($_POST['recWeeks'])."', '".mysql_real_escape_string($date)."' + INTERVAL ($i * 7) DAY, '".mysql_real_escape_string($startdate)."', '".mysql_real_escape_string($enddate)."', '".mysql_real_escape_string($_POST['title'])."', '".mysql_real_escape_string($_POST['body'])."', '".mysql_real_escape_string($_POST['email'])."', '".mysql_real_escape_string($_POST['practitioner'])."', '".mysql_real_escape_string($_POST['phone'])."', '".mysql_real_escape_string($_FILES['image']['name'])."', now() )"; $result = mysql_query($sql) or die(mysql_error()); }
However, i can see a problem when it comes to updating. This is my current update function:
public function updateCourse($category){ if(is_numeric($_POST['ID'])){ if(isset($_FILES['image']['name']) && $_FILES['image']['name'] != ""){ $image = ", image = '".mysql_real_escape_string($_FILES['image']['name'])."'"; }else{ $image = ''; } $date = $_POST['year'].'-'.$_POST['month'].'-'.$_POST['day'] ." ".$_POST['hours'].":".$_POST['minutes'].":00"; $startdate = "0000-00-00 ".$_POST['starthours'].":".$_POST['startminutes'].":00"; $enddate = "0000-00-00 ".$_POST['endhours'].":".$_POST['endminutes'].":00"; $sql = "UPDATE tbl_courses SET date = '".mysql_real_escape_string($date)."', startdate = '".mysql_real_escape_string($startdate)."', enddate = '".mysql_real_escape_string($enddate)."', catID = '".mysql_real_escape_string($_POST['catID'])."', locID = '".mysql_real_escape_string($_POST['locID'])."', title = '".mysql_real_escape_string($_POST['title'])."', body = '".mysql_real_escape_string($_POST['body'])."', email = '".mysql_real_escape_string($_POST['email'])."', practitioner = '".mysql_real_escape_string($_POST['practitioner'])."', phone = '".mysql_real_escape_string($_POST['phone'])."', date_added = now() ".$image." WHERE ID = ".$_POST['ID'].""; $result = mysql_query($sql); return $result; }else{ die('ID needs to be numeric'); } }
How can i use the same method do update the number of recurring weeks?
Thanks
-
Hey,
I am trying to do an insert statement where i am trying to add a "Recurring weeks" method checking to see the value of a field (1, 2, 3.. etc) and insert multiple times with an increase of the date by 7 days depending on the number of recurring weeks.
For example, if you look at this image:
http://www.glofamily.com/glo/images/courses.jpg
You can see that a form where users can insert a course. Also look at the "Recurring weeks" dropdown. Taking this image as an example, i would have 3 insert statements, the first would have the date of 03/06/2010 and then i want to add another 2 with dates of 10/06/2010, 17/06/2010..
I thought i would need a for loop and have managed to put something together, but i don't think it's the right way to do it..
public function insertCourse($category){ $date = $_POST['year'].'-'.$_POST['month'].'-'.$_POST['day'] ." ".$_POST['hours'].":".$_POST['minutes'].":00"; $startdate = "0000-00-00 ".$_POST['starthours'].":".$_POST['startminutes'].":00"; $enddate = "0000-00-00 ".$_POST['finishhours'].":".$_POST['finishminutes'].":00"; $recWeeks = mysql_real_escape_string($_POST['recWeeks']); for($i=0; $i<recWeeks; $i++){ $sql = "INSERT INTO tbl_courses (catID, locID, date, startdate, enddate, title, body, email, practitioner, phone, image, date_added) VALUES ( '".mysql_real_escape_string($_POST['catID'])."', '".mysql_real_escape_string($_POST['locID'])."', '".mysql_real_escape_string($date)."', '".mysql_real_escape_string($startdate)."', '".mysql_real_escape_string($enddate)."', '".mysql_real_escape_string($_POST['title'])."', '".mysql_real_escape_string($_POST['body'])."', '".mysql_real_escape_string($_POST['email'])."', '".mysql_real_escape_string($_POST['practitioner'])."', '".mysql_real_escape_string($_POST['phone'])."', '".mysql_real_escape_string($_FILES['image']['name'])."', now() )"; $result = mysql_query($sql) or die(mysql_error()); } return "Successfully added course"; }
But don't know where to go from here, i would probably need to add
.mysql_real_escape_string($date)." + INTERVAL \'14\' DAY
But how can i incorporate this in my code??
Can someone please help?
Thanks again
Billy
-
Hey,
I am using a calendar on this page: http://www.glofamily.com/glo/about-us/, which can be seen in the right panel.
If you click on a day, it takes you to a page like so:
http://www.glofamily.com/glo/general-courses/?day=2 June 2010
Now i want to be able to have the link to be like this: ?day=02 June 2010 so i need to change the way the links work on the calendar, i tried using number_format but had no luck.
This is my code for the calendar, where do i need to change the code to achieve this?
<div id="calendar" class="right"> <?php $date = (!isset($_GET['month']) && !isset($_GET['year'])) ? time() : strtotime($_GET['month'] . '/1/' . $_GET['year']); $day = date('d', $date) ; $month = date('m', $date) ; $year = date('Y', $date) ; $first_day = mktime(0,0,0,$month, 1, $year) ; $title = date('F', $first_day) ; $day_of_week = date('D', $first_day) ; switch($day_of_week){ case "Sun": $blank = 0; break; case "Mon": $blank = 1; break; case "Tue": $blank = 2; break; case "Wed": $blank = 3; break; case "Thu": $blank = 4; break; case "Fri": $blank = 5; break; case "Sat": $blank = 6; break; } $days_in_month = cal_days_in_month(0, $month, $year) ; ?> <div id="php-calendar" class="right"> <table> <?php if(isset($_GET['ID']) && isset($_GET['c'])){ echo "<tr><th colspan=7><a href=\"?ID=".$_GET['ID']."&c=".$_GET['c']."&month=". ($month - 1) . "&year=$year\"><<</a> $title $year <a href=\"?ID=".$_GET['ID']."&c=".$_GET['c']."&month=" . ($month + 1) . "&year=$year\">>></a></th></tr>"; } else { echo "<tr><th colspan=7><a href=\"?month=". ($month - 1) . "&year=$year\"><<</a> $title $year <a href=\"?month=" . ($month + 1) . "&year=$year\">>></a></th></tr>"; } ?> <tr><td width=42>S</td><td width=42>M</td><td width=42>T</td><td width=42>W</td><td width=42>T</td><td width=42>F</td><td width=42>S</td></tr> <?php $day_count = 1; echo "<tr>"; while ( $blank > 0 ) { echo "<td></td>"; $blank = $blank-1; $day_count++; } $day_num = 1; while ( $day_num <= $days_in_month ) { echo "<td> <a href='../general-courses/?day=$day_num $title $year'>$day_num</a></td>"; $day_num++; $day_count++; if ($day_count > 7) { echo "</tr><tr>"; $day_count = 1; } } while ( $day_count >1 && $day_count <=7 ) { echo "<td> </td>"; $day_count++; } ?> </table> </div> </div>
Can you guys help me out?
Thanks again
Billy
-
Thanks jcbones!
That worked perfectly!
Thanks again
Billy
-
Hey,
I have made a basic calendar on this page:
http://www.glofamily.com/glo/test/
I have this code:
<?php //This gets today's date $date = time () ; //This puts the day, month, and year in seperate variables $day = date('d', $date) ; $month = date('m', $date) ; $year = date('Y', $date) ; //Here we generate the first day of the month $first_day = mktime(0,0,0,$month, 1, $year) ; //This gets us the month name $title = date('F', $first_day) ; //Here we find out what day of the week the first day of the month falls on $day_of_week = date('D', $first_day) ; //Once we know what day of the week it falls on, we know how many blank days occure before it. If the first day of the week is a Sunday then it would be zero switch($day_of_week){ case "Sun": $blank = 0; break; case "Mon": $blank = 1; break; case "Tue": $blank = 2; break; case "Wed": $blank = 3; break; case "Thu": $blank = 4; break; case "Fri": $blank = 5; break; case "Sat": $blank = 6; break; } //We then determine how many days are in the current month $days_in_month = cal_days_in_month(0, $month, $year) ; //Here we start building the table heads echo "<table border=1 width=294>"; echo "<tr><th colspan=7> $title $year </th></tr>"; echo "<tr><td width=42>S</td><td width=42>M</td><td width=42>T</td><td width=42>W</td><td width=42>T</td><td width=42>F</td><td width=42>S</td></tr>"; //This counts the days in the week, up to 7 $day_count = 1; echo "<tr>"; //first we take care of those blank days while ( $blank > 0 ) { echo "<td></td>"; $blank = $blank-1; $day_count++; } //sets the first day of the month to 1 $day_num = 1; //count up the days, untill we've done all of them in the month while ( $day_num <= $days_in_month ) { echo "<td> <a href='general-courses/?day=$day_num $title $year'>$day_num</a></td>"; $day_num++; $day_count++; //Make sure we start a new row every week if ($day_count > 7) { echo "</tr><tr>"; $day_count = 1; } } //Finaly we finish out the table with some blank details if needed while ( $day_count >1 && $day_count <=7 ) { echo "<td> </td>"; $day_count++; } echo "</table>"; ?>
I have managed to get the days as links, however i need to also have an arrow to flip between months. How can i do this?
Hopefully someone can help.
Thanks again
Regards
Billy
How can i display this?
in CSS Help
Posted
Thanks mate..
Well is there a way i can do it with CSS? If you look at the images they are all different shapes and sizes..
If they were the same height but different widths it would be quite simple which is what i have now:
http://www.freemanholland.com/cow/public_html/
But i need to have it like this:
http://www.freemanholland.com/cow/homepage.jpg
Can you help?
And i didn't design the site