Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
T

tryingmybest89

@tryingmybest89
About
Posts
2
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • add and show events on a calender in php/msql problem
    T tryingmybest89

    o ok. that makes sense! i went back through my code and added in a $_GET to get the $m, $y, and $d. I also changed it from joeuser to root and password to "" since there wasnt a password set up. I found that I wasnt calling my database by the right in the connection call. Thank you for your help!

    Linux, Apache, MySQL, PHP php html help question

  • add and show events on a calender in php/msql problem
    T tryingmybest89

    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

    Linux, Apache, MySQL, PHP php html help question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups