Jump to content

ajetrumpet

Members
  • Posts

    195
  • Joined

  • Last visited

Everything posted by ajetrumpet

  1. this is a static file and its a stand alone report. but my script to capture the traffic data and throwing it into the database is a script that is included in all pages on my website.
  2. very funny dude. great picture! here's what we have here:
  3. that's horrible. I drove a Toyota Yaris for years. 40 mpg for those guys! Only the hybrids get better than that! But i totaled all 3 yarises in 3 years time. hit a deer with each one. those are easy to damage tho...made of plastic. Mercedes Benz cars...now those are tanks! steel enforced!
  4. what amount of cylinders does 5L equate to? I hear petrol in England is pretty expensive.
  5. not for cleaners that run their own businesses. however, companies that clean homes generally hire employees at that rate, yes.
  6. that's ridiculous Barand! custodians over here earn anywhere from $9 USD to $12 USD. Given your age, I would say you're retired by now? What in the world do you need anymore money for!?
  7. can you come over and clean my house too? 😀
  8. you guys are suppose to be coding specialists, not grammar specialists!
  9. ok guys I think I understand. thanks for setting me strait.
  10. is it true that all the server side code runs before the client side code when accessing a webpage? if that is true, what about PHP code that is embedded inside HTML tags? wouldn't that result in an error a lot of times?
  11. enough searching found me the answer. this does what I was looking for: <?php $dbHost = "localhost"; $dbName= "rptDatabase"; $dbUsername = "username"; $dbPassword = "password"; $conn = mysqli_connect($dbHost, $dbUsername, $dbPassword, $dbName); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $sql = mysqli_query($conn, "SELECT * FROM tblTraffic ORDER BY ip, date, time"); $column_count = 5; $i = 1; echo "<table border=1 width=100%> <tr> <th width=20%>IP ADDRESS</th> <th width=20%>PAGE VISITED</th> <th width=20%>PREVIOUS PAGE</th> <th width=20%>DATE</th> <th width=20%>TIME</th> </tr>"; $fields_num = mysqli_num_fields($sql); echo "<table border=0 width=100%><tr>"; // printing table rows while($row = mysqli_fetch_array($sql)) { if ($i == 1) { echo '<tr width=100%>'; } echo "<td width=20% align='center'>".$row[1]."</td>"; echo "<td width=20% align='center'>".$row[2]."</td>"; if(empty($row[3])) { echo "<td width=20% align='center'>"."N/A"."</td>"; } else { echo "<td width=20% align='center'>".$row[3]."</td>"; } echo "<td width=20% align='center'>".$row[4]."</td>"; echo "<td width=20% align='center'>".$row[5]."</td>"; $i++; echo '</tr>'; } echo '</table>'; $conn->close(); ?>
  12. I found something close: $fields_num = mysqli_num_fields($sql); echo "<h1>Table: {tblTraffic}</h1>"; echo "<table border='1'><tr>"; // printing table headers for($i=0; $i<$fields_num; $i++) { $field = mysqli_fetch_field($sql); echo "<td>{$field->name}</td>"; } echo "</tr>\n"; // printing table rows while($row = mysqli_fetch_row($sql)) { echo "<tr>"; // $row is array... foreach( .. ) puts every element // of $row to $cell variable foreach($row as $cell) echo "<td>$cell</td>"; echo "</tr>\n"; } but I'm getting 1 row printed out with my field names instead of the field content.
  13. well I can't find the right thing on the web as an example. this is not right, but is it close? foreach($row as $value) { echo "<td>$value</td>"; }
  14. i'm doing my best to research this stuff guys, but I keep getting stuck. My reporting is almost finished, but I'm stuck at the part of my code that's denoted by "//FOR EACH LOOP HERE?" Can someone help? in addition to this missing code I need, I also get the error "mysqli_num_rows() expects parameter 1 to be mysqli_resul". But all these examples on the web use pretty much the same code like this. <?php $dbHost = "localhost"; $dbName= "rptDatabase"; $dbUsername = "username"; $dbPassword = "password"; $conn = mysqli_connect($dbHost, $dbUsername, $dbPassword, $dbName); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $sql = mysqli_query($conn, "SELECT * FROM tblTraffic ORDER BY ip, date, time"); $report = mysqli_fetch_array($sql); echo "<table border='1'> <tr> <th>IP ADDRESS</th> <th>PAGE VISITED</th> <th>PREVIOUS PAGE</th> <th>DATE</th> <th>TIME</th> </tr>"; if (mysqli_num_rows($report) > 0) { while($row = mysqli_fetch_array($report)) { echo "<tr>"; //FOR EACH LOOP HERE? } } else { echo "0 results"; } $conn->close(); ?>
  15. no it doesn't. nor does modifying the .htaccess file. i also tried that. but godaddy specifically told me the default timezone can't be changed.
  16. I apologizing for bothering the expert here again, but I've run into another issue. I am using the following code because I can't change the default timezone on my shared hosting plan: $time = date("h:i A", strtotime("+19 hours")); there are few issues with this. if I just use: date("h:i: A") the time prints as 7 hours earlier than my timezone, and currently it shows 1:09 AM and it appears in the database as "01:09:00". if I use the code above, the time prints out as "08:09 PM", but it is inserted into the database as "08:09:00". Shouldn't it read "20:09:00" instead? and why isn't the time being inserted into the database with the "PM" suffix on it like it appears in the printout? the "time" field in my database is set to type TIME. thanks.
  17. SOLVED: $dbHost apparently has to be "localhost". now why in the hell is that the case!? have you ever heard of this? that does not seem right at all. it should be an ip address or domain name, shouldn't it? Look I really appreciate you sticking with me through this. and for your script. I will make an effort to become a little more educated in PHP.
  18. yes i have access to phpMyAdmin. the agent even created a user for rptDatabase and a password and she ran a script she got from a higher level agent and she claims she was able to connect. she could not see the script code though, so she couldn't tell me what her connection string looked like. the only 2 things she did differently than me was use "localhost" for $dbHost variable and she also included a port number in the connection string arguments, but the port is optional. I got the username and password that she used from her and tried to use on my script and got the same damn error.
  19. Berand, I just finished with godaddy and they pretty much pissed me off. I have tried this with "ipaddress" in the $dbHost variable and "www.domainname.com" in it as well. I've also tried my own username and password with both those options for $dbHost as well as tried the actual server's "username" and "password" for those variables as well. everything i've tried results in the same damn error. and godaddy claims everything is fine on their end. what do you think?
  20. well this is just a test script. when I implement this to work fulltime I will look into that more closely. r u saying one should not have full privaleges even if they are the site owner / admin?
  21. hmmm...I've been working on this a little too long I think. No more parse error, but it is still denying my credentials: [13-Oct-2019 20:52:27 UTC] PHP Fatal error: Uncaught exception 'mysqli_sql_exception' with message 'Access denied for user 'username'@'ip-ipaddress.ip.secureserver.net' (using password: YES)' in /home/name/public_html/DOMAIN/test/recordpageview.php:14 Stack trace: #0 /home/name/public_html/DOMAIN/test/recordpageview.php(14): mysqli->mysqli('ipaddress, 'username', 'password', 'rptDatabase') #1 {main} thrown in /home/name/public_html/DOMAIN/test/recordpageview.php on line 14 I will contact GoDaddy and see what the issue is.
  22. i tried: $dbHost = "ip address"; $dbName= "rptDatabase"; $dbUsername = "username"; $dbPassword = "password"; $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''; $page = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''; $referrer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; $date = date("m/d/y"); $time = date("h:i:a"); mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT); $conn = new mysqli($dbHost, $dbUsername, $dbPassword, $dbName) $stmt = $conn->prepare("INSERT INTO tblTraffic (ip, page, referrer, date, time) VALUES (?, ?, ?, ?, ?)"); $stmt->bind_param("sssss", $ip, $page, $referrer, $date, $time); $stmt->execute(); $stmt->close(); $conn->close(); and I get only one error, but coming from you I can't understand why this would be thrown now: [13-Oct-2019 20:39:37 UTC] PHP Parse error: syntax error, unexpected '$stmt' (T_VARIABLE) in /home/name/public_html/DOMAIN/test/recordpageview.php on line 16
  23. thanks for the new script. i'll try it and get back to you.
×
×
  • 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.