+ Post New Thread
Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22
Coding Thread, Xibo birthday display - php or similar maybe? in Coding and Web Development; I have a birthdays.php running on a seperate webserver and just get xibo to view that webpage :-) Just a ...
  1. #16
    BKGarry's Avatar
    Join Date
    Mar 2006
    Location
    Kent
    Posts
    923
    Thank Post
    94
    Thanked 119 Times in 96 Posts
    Rep Power
    47
    I have a birthdays.php running on a seperate webserver and just get xibo to view that webpage :-) Just a basic LAMP server nothing special, runs several websites, including wordpress, but the birthdays.php just sits in its own folder and works :-)

    Hope this helps

  2. #17

    3s-gtech's Avatar
    Join Date
    Mar 2009
    Location
    Wales
    Posts
    2,780
    Thank Post
    146
    Thanked 564 Times in 508 Posts
    Rep Power
    153
    Quote Originally Posted by cleverleyson View Post
    Im having a little problem trying to get this to work, I've created a database in Phpmyadmin called Birthdays.students with a table of three fields, Forname, Surname and Dob. I then add the code above into an emded page in xibo. I think this might be where i'm going wrong. Do I need to create a .php or put said code into xibo? Also where should i put config.php

    I feel like I'm nearly there!


    Thanks for all the help above!
    We get Xibo to display an external webpage running on a webserver. Nothing embedded.

  3. #18

    Join Date
    Feb 2013
    Location
    Chippenham
    Posts
    3
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Ahhh Cheers for the advice, I still get get it to work tho! been trying to find out why i get the error message

    "
    "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\birthdays\Birthdays.php on line 48
    No birthday's today!"

    I think it might be the way ive setup the tables? I think its something simple. Losing alot of time to this already!


    "


  4. #19

    glennda's Avatar
    Join Date
    Jun 2009
    Location
    Sussex
    Posts
    7,810
    Thank Post
    272
    Thanked 1,135 Times in 1,031 Posts
    Rep Power
    349
    what is your host setup? thats looking for an absolute path - is that written in the code (i've not seen it)

  5. #20

    Join Date
    Feb 2013
    Location
    Chippenham
    Posts
    3
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Im using the code posted from above.

    <?php

    include('config.php');

    ?>
    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    background-image: url(Background.png);
    background-repeat: no-repeat;
    }
    body,td,th {
    font-family: "Segoe UI Light";
    color: #000;
    font-size: large;
    }
    </style>
    </head>

    <body>
    <p><br />
    </p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p><br />
    <br />
    </p>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="5%" height="303">&nbsp;</td>
    <td width="62%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td height="265" valign="top"><h1>
    <br />
    <?php

    $myDate = date('d/m');
    $badgesql = mysql_query("SELECT * FROM birthdays.students WHERE `Date` LIKE '%$myDate%'"); // birthdays is the DB, the table is called students - you can change these
    $badgecheck = mysql_num_rows($badgesql);
    $check = $badgecheck;
    if($check==0)
    echo('No birthday\'s today!');
    else
    if($badgecheck!=0)
    {
    while($badge = mysql_fetch_array($badgesql))
    {

    echo(''.$badge[Firstname].' '.$badge[Surname].'<br>');

    }
    }
    <?
    $host = "localhost"; // if the database is locally installed
    $dbuser = "'Birthdays";
    $dbpwd = "XXXX";
    $db = "birthdays."; // this is the database name
    $connect = mysql_pconnect($host, $dbuser, $dbpwd);
    if(!$connect)
    echo("Could not connect to database...");
    else
    $select = mysql_select_db($db);
    ?>
    The database is on the same server as xibo server, hence localhost. could it be the the tables need to be a type (its text atm) Also Would i need to move the year from date?
    Last edited by cleverleyson; 1st March 2013 at 12:04 PM.

  6. #21
    MHUK's Avatar
    Join Date
    Jul 2012
    Location
    Lincolnshire
    Posts
    14
    Thank Post
    14
    Thanked 3 Times in 2 Posts
    Rep Power
    5
    @cleverleyson I had this error. In the table, is the column with the dates in called dob? I had mine called "Date of Birth" but once renamed to "Date" to match the code it worked. I set my First/Last name columns to VARCHAR and the DOB to Date.
    Last edited by MHUK; 4th March 2013 at 08:48 AM.

  7. #22
    jaminben's Avatar
    Join Date
    Oct 2012
    Location
    Norfolk
    Posts
    278
    Thank Post
    62
    Thanked 21 Times in 20 Posts
    Rep Power
    12
    Quote Originally Posted by MHUK View Post
    @cleverleyson I had this error. In the table, is the column with the dates in called dob? I had mine called "Date of Birth" but once renamed to "Date" to match the code it worked. I set my First/Last name columns to VARCHAR and the DOB to Date.
    Just as a FYI you could have also changed the SQL query to match the database column name...

    From:
    Code:
    $badgesql = mysql_query("SELECT * FROM birthdays.students WHERE `Date` LIKE '%$myDate%'")
    To:
    Code:
    $badgesql = mysql_query("SELECT * FROM birthdays.students WHERE `Date of Birth` LIKE '%$myDate%'")
    This may make it easier to work out in the future if you ever come back to it as the DB column name will be what your expecting it to be (i.e a DOB).

    The reason for the error is that your code is expecting a result of some number of rows but you had an error in the query which the mysql_num_rows() couldn't interpret. You could prevent this with something like:

    Code:
    $badgesql = "SELECT * FROM birthdays.students WHERE `Date of Birth` LIKE '%$myDate%'"
    if (mysql_query($badgesql)){
     echo "This Worked - Continue Code Here";
     }else{
     echo "This Failed - Exit Code Here: " . mysql_error();
     exit();
     }
    Last edited by jaminben; 5th March 2013 at 07:50 PM.

  8. Thanks to jaminben from:

    MHUK (6th March 2013)

SHARE:
+ Post New Thread
Page 2 of 2 FirstFirst 12

Similar Threads

  1. LAN VoIP or similar
    By Samson in forum Wireless Networks
    Replies: 5
    Last Post: 20th June 2007, 10:02 AM
  2. Replies: 1
    Last Post: 8th June 2007, 08:43 PM
  3. PHP or ASP.NET
    By plugged_in in forum Web Development
    Replies: 38
    Last Post: 8th March 2007, 11:08 AM
  4. PHP or JavaScript password obfuscator
    By ajbritton in forum Web Development
    Replies: 2
    Last Post: 18th October 2006, 08:30 AM
  5. Replies: 11
    Last Post: 3rd February 2006, 12:29 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •