₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,328,309 members, 8,435,111 topics. Date: Saturday, 27 June 2026 at 11:37 PM

Toggle theme

Taofeeq137's Posts

Nairaland ForumTaofeeq137's ProfileTaofeeq137's Posts

1 2 3 4 5 6 7 8 9 10 11 12 13 (of 13 pages)

CelebritiesRe: Rotimi Alakija aka DJ Xclusive: Is He Cutest Nigerian Male Celebrity? by taofeeq137(m): 8:42am On Aug 09, 2014
Desmond

WebmastersRe: Please Help With This Sql Problem by taofeeq137(m): 12:50pm On Jul 22, 2014
I am surprised this thread has not been solved.
It should have cos the guy said he got it
WebmastersRe: Please Help With This Sql Problem by taofeeq137(m): 9:36am On Jul 20, 2014
WebRabbi: @ daddynasa, you can use my own solution ie
<?php

$server = 'localhost'; $username = 'root'; $password = ''; $database = 'messagBox';
$conn = new PDO("mysql:host=$server; dbname=$database", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$conn->exec("SET CHARACTER SET utf8"wink;


function SoftUserName($conn, $userID){

$SoftQuery = "SELECT uname

FROM users

WHERE userid = :userid";


$soft_prep = $conn->prepare($SoftQuery);

$soft_prep->bindValue(':userid', $userID);

$soft_prep->execute();

$rows_count = $soft_prep->rowCount();

if($rows_count == 1) {

while($row = $soft_prep->fetch(PDO::FETCH_ASSOC)) {

$userName = $row['uname'];

}

}else{

$userName = 'Anonymous';
}

return $userName;

}

$senderID = 1;
$recepID = 2;

$SenderName = SoftUserName($conn, $senderID);
$RecepName = SoftUserName($conn, $recepID);

$SoftQuery = "SELECT msgid, senderid, recipientid, msg, datesent

FROM message

WHERE senderid = :senderid

OR senderid = :recipientid

OR recipientid = :recipientid

OR recipientid = :senderid

ORDER BY datesent ASC";


$soft_prep = $conn->prepare($SoftQuery);

$soft_prep->bindValue(":senderid", $senderID);
$soft_prep->bindValue(":recipientid", $recepID);

$soft_prep->execute();


$rows_count = $soft_prep->rowCount();

if($rows_count >= 1) {

while($row = $soft_prep->fetch(PDO::FETCH_ASSOC)) {

$msgid = $row["msgid"];
$msg = $row["msg"];
$datesent = $row["datesent"];
$senderid = $row["senderid"];
$recipientid = $row["recipientid"];

if(($senderid == $senderID) && ($senderid != $recipientid)){

echo "<div style='float:left; border: 1px solid #333; color:#03F; padding: 30px; margin: 10px;'>
$SenderName : $msg, $datesent</div><br clear='all' />";

}


if (($recipientid == $senderID) && ($senderid != $recipientid)){

echo "<div style='float:right; border: 1px solid #333; color:#03F; padding: 30px; margin: 10px;'>
$RecepName : $msg, $datesent</div><br clear='all'/>";

}

$senderid = ''; $recipientid = ''; $msg ='';


}

}else{

echo "Error Msg";

}

?>

WebmastersPlease Help Me To Review This Site And Tell Me On Improvements To Make by taofeeq137(op):
www.sarch.somee.com
Add me with Oluwafemi Leonardo Taofeeq to test the messaging too, by searching for taofeeq after you have logged in
WebmastersRe: Please Help With This Sql Problem by taofeeq137(m): 1:29pm On Jul 18, 2014
WebRabbi: @ daddynasa, you can use my own solution ie

<?php

$server = 'localhost'; $username = 'root'; $password = ''; $database = 'messagBox';
$conn = new PDO("mysql:host=$server; dbname=$database", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$conn->exec("SET CHARACTER SET utf8"wink;


function SoftUserName($conn, $userID){

$SoftQuery = "SELECT uname

FROM users

WHERE userid = :userid";


$soft_prep = $conn->prepare($SoftQuery);

$soft_prep->bindValue(':userid', $userID);

$soft_prep->execute();

$rows_count = $soft_prep->rowCount();

if($rows_count == 1) {

while($row = $soft_prep->fetch(PDO::FETCH_ASSOC)) {

$userName = $row['uname'];

}

}else{

$userName = 'Anonymous';
}

return $userName;

}

$senderID = 1;
$recepID = 2;

$SenderName = SoftUserName($conn, $senderID);
$RecepName = SoftUserName($conn, $recepID);

$SoftQuery = "SELECT msgid, senderid, recipientid, msg, datesent

FROM message

WHERE senderid = :senderid

OR senderid = :recipientid

OR recipientid = :recipientid

OR recipientid = :senderid

ORDER BY datesent ASC";


$soft_prep = $conn->prepare($SoftQuery);

$soft_prep->bindValue(":senderid", $senderID);
$soft_prep->bindValue(":recipientid", $recepID);

$soft_prep->execute();


$rows_count = $soft_prep->rowCount();

if($rows_count >= 1) {

while($row = $soft_prep->fetch(PDO::FETCH_ASSOC)) {

$msgid = $row["msgid"];
$msg = $row["msg"];
$datesent = $row["datesent"];
$senderid = $row["senderid"];
$recipientid = $row["recipientid"];

if(($senderid == $senderID) && ($senderid != $recipientid)){

echo "<div style='float:left; border: 1px solid #333; color:#03F; padding: 30px; margin: 10px;'>
$SenderName : $msg, $datesent</div><br clear='all' />";

}


if (($recipientid == $senderID) && ($senderid != $recipientid)){

echo "<div style='float:right; border: 1px solid #333; color:#03F; padding: 30px; margin: 10px;'>
$RecepName : $msg, $datesent</div><br clear='all'/>";

}

$senderid = ''; $recipientid = ''; $msg ='';


}

}else{

echo "Error Msg";

}

?>
Tried this on asp.net, worked fine, nice one
WebmastersRe: Please Help With This Sql Problem by taofeeq137(m): 10:39am On Jul 18, 2014
WebRabbi: @ daddynasa, you can use my own solution ie

<?php

$server = 'localhost'; $username = 'root'; $password = ''; $database = 'messagBox';
$conn = new PDO("mysql:host=$server; dbname=$database", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$conn->exec("SET CHARACTER SET utf8"wink;


function SoftUserName($conn, $userID){

$SoftQuery = "SELECT uname

FROM users

WHERE userid = :userid";


$soft_prep = $conn->prepare($SoftQuery);

$soft_prep->bindValue(':userid', $userID);

$soft_prep->execute();

$rows_count = $soft_prep->rowCount();

if($rows_count == 1) {

while($row = $soft_prep->fetch(PDO::FETCH_ASSOC)) {

$userName = $row['uname'];

}

}else{

$userName = 'Anonymous';
}

return $userName;

}

$senderID = 1;
$recepID = 2;

$SenderName = SoftUserName($conn, $senderID);
$RecepName = SoftUserName($conn, $recepID);

$SoftQuery = "SELECT msgid, senderid, recipientid, msg, datesent

FROM message

WHERE senderid = :senderid

OR senderid = :recipientid

OR recipientid = :recipientid

OR recipientid = :senderid

ORDER BY datesent ASC";


$soft_prep = $conn->prepare($SoftQuery);

$soft_prep->bindValue(":senderid", $senderID);
$soft_prep->bindValue(":recipientid", $recepID);

$soft_prep->execute();


$rows_count = $soft_prep->rowCount();

if($rows_count >= 1) {

while($row = $soft_prep->fetch(PDO::FETCH_ASSOC)) {

$msgid = $row["msgid"];
$msg = $row["msg"];
$datesent = $row["datesent"];
$senderid = $row["senderid"];
$recipientid = $row["recipientid"];

if(($senderid == $senderID) && ($senderid != $recipientid)){

echo "<div style='float:left; border: 1px solid #333; color:#03F; padding: 30px; margin: 10px;'>
$SenderName : $msg, $datesent</div><br clear='all' />";

}


if (($recipientid == $senderID) && ($senderid != $recipientid)){

echo "<div style='float:right; border: 1px solid #333; color:#03F; padding: 30px; margin: 10px;'>
$RecepName : $msg, $datesent</div><br clear='all'/>";

}

$senderid = ''; $recipientid = ''; $msg ='';


}

}else{

echo "Error Msg";

}

?>
nyc, i'll try this in c#
WebmastersRe: Best Affordable Web Hosting by taofeeq137(m): 9:25pm On Jul 15, 2014
Please any cheap web host for asp.net, windows hosting
WebmastersRe: Please Help With This Sql Problem by taofeeq137(m): 8:46pm On Jul 15, 2014
daddynasa: what I now did is select * from msg where((senderid=1 or recipientid=1)and(senderid=2 or recipientid=2))
Or select * from msg where senderid=1 and recipientid=2 union all select * from msg where senderid=2 and recipientid =1 sortby [date] desc, that should do
WebmastersRe: Please Help With This Sql Problem by taofeeq137(m): 5:52pm On Jul 14, 2014
dhtml: You are welcome. So once you do left join on the tables, that should solve the problem.
Why not full outer join?
WebmastersRe: Please Help With This Sql Problem by taofeeq137(m): 5:16pm On Jul 14, 2014
daddynasa: got it. treated each conversation between pair as a thread using thread Id. thanks a lot for Ur contribution
How's dat, I don't get dat, it looks simpler, when I did mine, I saved d Messageid as d Id of the first message sender and then when d other user tries to send message, the database is checked to see if there was a previous Id in which the receivers name appears, I there is, use the same id, if not, create another Id for the two new chatters, please explain your way of joinin two ids to one id
WebmastersRe: Webmasters Please Help!!!!!! by taofeeq137(op): 4:29pm On Jul 13, 2014
dhtml: A chat will definitely involve database for data persistence over network. You must do proper research on how to get that done, i dont use .net so i cannot really help you much, i can only give general advices.
ok, thanks
WebmastersRe: Webmasters Please Help!!!!!! by taofeeq137(op): 4:17pm On Jul 13, 2014
dhtml: That is where javascript/ajax comes in. See, developing a chat system is not beans at all, you must really be an expert before you can create one that works properly. These challenges you are facing are just a tip of the ice berg, there are more difficult challenges ahead of you to create a chat system.
well, i can create a chat application, with signalr (a javascript language for asp.net), but i dont know how to save it in a database, dats why i want to use an alternative for the same thing
WebmastersRe: Webmasters Please Help!!!!!! by taofeeq137(op): 3:57pm On Jul 13, 2014
dhtml: Are you sure you are ready to create a chat eh?

dhtml: hello seun
that goes into database like this:
to->seun, from->dhtml,message->hello seun,time->now,status->unread

Since seun is obviously online, javascript/ajax checks message thread for unread messages posted to seun
seun now sees:
dhtml:hello seun
and the status is changed to read

and the messages go back and forth?
i get that, i tried that, but i have problem when i want the user to reply the message and still be displayed on the same page from the database
WebmastersWebmasters Please Help!!!!!! by taofeeq137(op): 12:58pm On Jul 13, 2014
i want to create a messaging page in asp.net, where a user can send message to another user (just 2 users per chat), I thought of using Unique identifier to keep the message between the two users, but i dont know how the Unique identifier will be generated for the two users once one of them clicks on the other user to send message, PLEASE HELP
Tech JobsRe: Free Ebooks On Programming by taofeeq137(m): 11:17pm On Nov 02, 2013
I need ebooks on c++ and JAVA

1 2 3 4 5 6 7 8 9 10 11 12 13 (of 13 pages)