troubleshooting Question

PHP MYSQL QUERY

Avatar of blknyella
blknyella asked on
PHPMySQL ServerSQL
4 Comments1 Solution204 ViewsLast Modified:
Ok, i've got the code working and a table is coming up after the exec-process runs. Issue i'm having is that i can't get the username slashed down to just the username.

i.e. - username@demo.test.com

TIA

<?php

include 'connect.php';

$part1 = $_POST['participant1'];
$part2 = $_POST['participant2'];

$query = "select fromJID, toJID, body, sentDate, from_unixtime(sentDate/1000) as msgSentDate from ofMessageArchive where fromJID like '".$part1."%' or toJID like '".$part1."%'";

$sql = mysql_query($query) or die(mysql_error());

echo "<table border='1' cellpadding='5'>";
echo "<tr> <th>Date</th> <th>From</th> <th>To</th> <th>Body</th>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array($sql)){
	
	// Print out the contents of each row into a table
	echo "<tr><td>";
	echo $row['msgSentDate'];
	echo "</td><td>";
	echo $row['fromJID'];
	echo "</td><td>";
	echo $row['toJID'];
	echo "</td><td>";
	echo $row['body'];
	echo "</td></tr>";
}
echo "</table>";
?>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros