Click here to Skip to main content
15,886,724 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
GeneralRe: More of a poll than a question... Pin
Slacker0078-Apr-11 7:32
professionalSlacker0078-Apr-11 7:32 
GeneralRe: More of a poll than a question... Pin
Albert Holguin8-Apr-11 9:24
professionalAlbert Holguin8-Apr-11 9:24 
AnswerRe: More of a poll than a question... Pin
Paul Darlington14-Apr-11 5:11
Paul Darlington14-Apr-11 5:11 
GeneralRe: More of a poll than a question... Pin
Albert Holguin14-Apr-11 5:15
professionalAlbert Holguin14-Apr-11 5:15 
AnswerRe: More of a poll than a question... Pin
jschell14-Apr-11 9:52
jschell14-Apr-11 9:52 
GeneralRe: More of a poll than a question... Pin
Albert Holguin14-Apr-11 10:03
professionalAlbert Holguin14-Apr-11 10:03 
GeneralRe: More of a poll than a question... Pin
jschell15-Apr-11 8:58
jschell15-Apr-11 8:58 
Generaladd and show events on a calender in php/msql problem Pin
tryingmybest894-Apr-11 12:36
tryingmybest894-Apr-11 12:36 
Hi im trying to get my calender to display on the website but it is showing errors such as this:

Warning: mysqli_connect() [function.mysqli-connect]: (28000/1045): Access denied for user 'joeuser'@'localhost' (using password: YES) in C:\wamp\www\prog\addeventcal.php on line 8

Notice: Undefined variable: m in C:\wamp\www\prog\addeventcal.php on line 26 & 27 & 28

Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in C:\wamp\www\prog\addeventcal.php on line 29

here is my code. Can you please explain as to why it is not working. thank you

<html>
<head>
<title>Show/Add Events</title>
<head>
<body>
<h1>Show/Add Events</h1>
<?php
$mysqli = mysqli_connect("localhost", "joeuser", "YES", "testDB");

//Add any new event
if($_POST){
	$m = $_POST["m"];
	$d = $_POST["d"];
	$y = $_POST["y"];
	
	$event_date = $y."-".$m."-".$d." ".$_POST["event_time_hh"].";
	".$_POST["event_time_mm"].":00";
	$insEVENT_sql = "INSERT INTO calender_events(event_title, event_shortdesc, event_start) VALUES('".$_POST["event_title"]."';
	'".$_POST["event_shortdesc"]."', '$event_date')";
	$insEvent_res = mysqli_query($mysqli, $insEvent_sql)
					or die(mysqli_error($mysqli));
}
//Show events for this day
$getEvent_sql = "SELECT event_title, event_shortdesc,
				 date_format(event_start, '%l:%i %p') as fmt_date FROM
				 calender_events WHERE month(event_start) = '".$m."'
				 AND dayofmonth(event_start) = '".$d."' AND
				 year(event_start)= '".$y."' ORDER BY event_start";
$getEvent_res = mysqli_query($mysqli, $getEvent_sql)
				or die(mysqli_error($mysqli));
				
if(mysqli_num_rows($getEvent_res) > 0){
	$event_txt = "<ul>";
	while($ev = @mysqli_fetch_array($getEvent_res)){
		$event_title = stripslashes($ev["event_title"]);
		$event_shortdesc = stripslashes($ev["event_desc"]);
		$fmt_date = $ev["fmt_date"];
		$event_txt .= "<li><strong>".$fmt_date."</strong>:
		".$event_title."<br/>".$event_shortdesc."</li>";
	}
	$event_txt .= "</ul>";
	mysqli_free_result($getEvent_res);
}else{
	$event_txt = "";
}

mysqli_close($mysqli);

if($event_txt != ""){
	echo "<p><strong>Today's Events:</strong></p>
	$event_txt
	<hr/>";
}

//Show form for the adding event
echo "
<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">
<p><strong>Would you like to add an event?</strong><br/>
Complete the form below and press the submit button to add
the event and refresh this window.</p>
<p><strong>Event Title:</strong><br/>
<input type=\"text\" name=\"event_title\" size=\"25\"
	maxlenght=\"25\"/>
<p><strong>Event Discription:</strong><br/>
<input type=\"text\" name=\"event_desc\" size=\"25\"
	maxlength=\"25\"/>
<p><strong>Event Time (hh:mm):</strong><br/>
<select name=\"event_time_hh\">";
for($x=1; $x <= 24; $x++){
	echo "<option value=\"$x\">$x</option>";
}
echo "</select> :
<select name=\"event_time_mm\">
<option value=\"00\">00</option>
<option value=\"15\">15</option>
<option value=\"30\">30</option>
<option value=\"45\">45</option>
</select>
<input type=\"hidden\" name=\"m\" value=\"".$m."\">
<input type=\"hidden\" name=\"d\" value=\"".$d."\">
<input type=\"hidden\" name=\"y\" value=\"".$y."\">
<br/><br/>
<input type=\"submit\" name=\"submit\" value=\"Add Event\">
</form>";
?>
</body>
</html>

GeneralRe: add and show events on a calender in php/msql problem Pin
Graham Breach5-Apr-11 0:16
Graham Breach5-Apr-11 0:16 
GeneralRe: add and show events on a calender in php/msql problem Pin
tryingmybest896-Apr-11 12:31
tryingmybest896-Apr-11 12:31 
GeneralRe: add and show events on a calender in php/msql problem Pin
Mutinda Boniface15-Apr-11 3:53
Mutinda Boniface15-Apr-11 3:53 
QuestionHow to know if a variable has been initiated or not [modified] Pin
Joan M30-Mar-11 7:56
professionalJoan M30-Mar-11 7:56 
AnswerRe: How to know if a variable has been initiated or not Pin
nickmaroulis30-Mar-11 13:35
nickmaroulis30-Mar-11 13:35 
GeneralRe: How to know if a variable has been initiated or not Pin
Joan M30-Mar-11 20:25
professionalJoan M30-Mar-11 20:25 
GeneralRe: How to know if a variable has been initiated or not Pin
nickmaroulis30-Mar-11 21:03
nickmaroulis30-Mar-11 21:03 
GeneralRe: How to know if a variable has been initiated or not Pin
nickmaroulis30-Mar-11 21:18
nickmaroulis30-Mar-11 21:18 
GeneralRe: How to know if a variable has been initiated or not Pin
Joan M30-Mar-11 21:41
professionalJoan M30-Mar-11 21:41 
GeneralRe: How to know if a variable has been initiated or not Pin
User 171649230-Mar-11 22:28
professionalUser 171649230-Mar-11 22:28 
GeneralRe: How to know if a variable has been initiated or not Pin
Joan M30-Mar-11 22:51
professionalJoan M30-Mar-11 22:51 
QuestionProblem with pointers / permissions? Pin
whatsa25-Mar-11 10:15
whatsa25-Mar-11 10:15 
AnswerRe: Problem with pointers / permissions? Pin
cjoki25-Mar-11 13:31
cjoki25-Mar-11 13:31 
AnswerRe: Problem with pointers / permissions? Pin
effayqueue25-Mar-11 23:50
effayqueue25-Mar-11 23:50 
AnswerRe: Problem with pointers / permissions? Pin
nickmaroulis30-Mar-11 13:38
nickmaroulis30-Mar-11 13:38 
Questionhow to bypass web filter Pin
yftah198923-Mar-11 7:12
yftah198923-Mar-11 7:12 
AnswerCross Post: Please Ingore Pin
Keith Barrow23-Mar-11 8:48
professionalKeith Barrow23-Mar-11 8:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.