Jump to content

seabro

Members
  • Posts

    10
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

seabro's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi all, I am a bit of a PHP rookie, never having had any training so I don't really know the best practices. In the past I have made sites out of lots of different files and more recently I made a whole site in a single index.php which had lots of options in a switch statement. The single file site was really messy as you can imagine. What's the norm? How do you guys find the right balance? Thanks! Seabro
  2. FIXED! Thanks for all your help. After I saw the error on the command line (that I wasn't seeing on my web page). I did some searching and one of the troubleshooting measures was Check if the php-mysql package is installed by opening a terminal window (bash), and typing, rpm -qa | grep php. If you don't see it, make a note of the exact version of PHP that is installed. I did this and I did not see php-mysql So I did yum install php-mysql, restarted apache and it all worked. sorry if I wasted anyones time I am a relative newbie. (I thought having PHP and MySQL installed was enough but there is obviously this php-mysql that glues them together).
  3. I tried from command line.. Does the following help troubleshoot or is it to be expected when execute from command line? [root@localhost ~]# php /var/www/html/stats/incoming.php Content-type: text/html X-Powered-By: PHP/4.3.9 <H1>Report Date</H1> PHP Fatal error: Call to undefined function: mysql_pconnect() in /var/www/html/stats/incoming.php on line 3 [root@localhost ~]#
  4. any more ideas on this one people? I looked in /var/log/mysql - nothing relevant. is there a PHP log? Any more troubleshooting I can do? I appreciate your help.
  5. I did this and there is still no error at all. The only thing on my page is the text between the H1 tags and test 1. The script is stopping at $connect=......... For the record I have tried a echo phpinfo() and that works and I have logged into the mysql database from the command line using the dbasename, username and password from the script. I have also change the localhost to 127.0.0.1 but get same result. I am baffled.. any more ideas?
  6. The following script was working on another server but stopped working when I moved to new server. The script returns Test 1 but not Test 2. It is dying at the line beginning $connect... I even commented out the Die() but that didn't help. Why won't it get past $connect? Assistance appreciated. <h1>Select Report Date</h1> <?php echo "test 1"; $connect = mysql_pconnect("localhost","user","pass"); // or Die("connect failed"); echo "test 2"; echo $connect; $selectdb = mysql_select_db("asterisk") or Die("select failed"); echo $selectdb; $query = "SELECT DISTINCT date_format(calldate,'%Y-%m-%d') as new_date from cdr ORDER BY new_date DESC LIMIT 50 "; echo $query; $connect; $selectdb; mysql_query($query) or die ("query x failed"); $res = mysql_query($query,$connect) or die("failed"); echo $res; print"<table align='center' border='1' cellspacing='0' cellpadding='5'>"; print "<tr>"; print "<td align='center'>"; print "Date"; print "</td>"; print "</tr>"; while($qry = mysql_fetch_array($res)) { $calldate=$qry["new_date"]; print "<tr>"; print "<td align='center'>"; print "<a href='incoming2.php?date="; print "$calldate'>"; print "$calldate"; print "</a>"; print "</td>"; }; ?>
  7. Thanks to all who replied. it's working now, I appreciate your help.
  8. Hi, Here is my mysql query. It works. SELECT dstchannel,sum(duration) from cdr where calldate like '2009-03-03%' group by substring(dstchannel,3,6) How can I display the result on my web page. I am trying the following but it not working and I don't know how to fix it. <?php $connect = mysql_pconnect("localhost","user","pass") or Die("connect failed"); $selectdb = mysql_select_db("dbase") or Die("select failed"); $query = "SELECT dstchannel,sum(duration) from cdr where calldate like '2009-03-03%' group by substring(dstchannel,3,6)"; $connect; $selectdb; mysql_query($query) or die ("query x failed"); $res = mysql_query($query,$connect) or die("failed"); while($qry = mysql_fetch_array($res)) { $dstchannel=$qry["dstchannel"]; print "$dstchannel"; print "<br>"; print "$duration"; print "<br>"; }; ?>
  9. Hi, I have a field in my database where the entries are like: 2009-02-16 14:05:28 2009-02-16 14:13:10 2009-02-16 14:08:29 2009-02-16 14:18:13 2009-02-16 14:39:11 2009-02-16 14:39:38 2009-02-16 14:40:23 2009-02-16 14:38:17 2009-02-16 14:41:21 2009-02-16 14:44:53 2009-02-16 14:44:59 The records are not all the same day but how can query to only show distinct days? I have tried SELECT DISTINCT but that doesn't work because they pretty much are distince with the times in them. Your help apprciated. Thanks. seabro
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.