Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,156,496 members, 7,830,498 topics. Date: Thursday, 16 May 2024 at 11:56 PM

Help Needed Mysql - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Help Needed Mysql (897 Views)

Help Needed To Get A Scammer / Free Online Training For Html/css, Javascript, Jquery, Mysql, Php, Java, Android / Learn PHP & MYSQL The Fast Way. (2) (3) (4)

(1) (Reply) (Go Down)

Help Needed Mysql by IntrovertedGuru(m): 1:43pm On Jul 06, 2019
I have a database table called *notes* where users can store different notes using different names. Now I can query the database using the *select from* function to get the notes entered by a particular user in a table.


Now what I want is for all the notes entered by a particular user to be retrieved from the database and convert it into a variable. I.e if a user has 5 records in the database table, 5 variables should be created using the name that was used to save the note and the value of the variable should correspond to what’s in the database record.

This is my table structure
NAME
USERNAME
NOTE


So if a user named John has 5 records with name1 name2 name3 name4 and name5 in the table 5 variables named $name1 $name2 $name3 $name4 and $name1 should be created and their values should correspond to the notes entered with those names in the database


I’d be glad if anyone can assist me
Re: Help Needed Mysql by Kamxin(m): 2:12pm On Jul 06, 2019
IntrovertedGuru:
I have a database table called *notes* where users can store different notes using different names. Now I can query the database using the *select from* function to get the notes entered by a particular user in a table.


Now what I want is for all the notes entered by a particular user to be retrieved from the database and convert it into a variable. I.e if a user has 5 records in the database table, 5 variables should be created using the name that was used to save the note and the value of the variable should correspond to what’s in the database record.

This is my table structure
NAME
USERNAME
NOTE


So if a user named John has 5 records with name1 name2 name3 name4 and name5 in the table 5 variables named $name1 $name2 $name3 $name4 and $name1 should be created and their values should correspond to the notes entered with those names in the database


I’d be glad if anyone can assist me

Try first and we will help out if there is a problem
Re: Help Needed Mysql by melodyogonna(m): 3:07pm On Jul 06, 2019
Have you tried doing it?
Re: Help Needed Mysql by IntrovertedGuru(m): 3:32pm On Jul 06, 2019
melodyogonna:
Have you tried doing it?
Yes and I couldn’t get it
Re: Help Needed Mysql by Doughboysss: 3:47pm On Jul 06, 2019
IntrovertedGuru:
I have a database table called *notes* where users can store different notes using different names. Now I can query the database using the *select from* function to get the notes entered by a particular user in a table.


Now what I want is for all the notes entered by a particular user to be retrieved from the database and convert it into a variable. I.e if a user has 5 records in the database table, 5 variables should be created using the name that was used to save the note and the value of the variable should correspond to what’s in the database record.

This is my table structure
NAME
USERNAME
NOTE


So if a user named John has 5 records with name1 name2 name3 name4 and name5 in the table 5 variables named $name1 $name2 $name3 $name4 and $name1 should be created and their values should correspond to the notes entered with those names in the database


I’d be glad if anyone can assist me


use a for loop or foreach

eg

foreach($records as $record){
$name[] = $record->name;
}

modified ***

$query="select * from notes where username = 'admin'";

$res=mysqli_query ($query');

while($rows=mysqli_fetch_array ($res)){
$names[]=$rows['text'];
}
Re: Help Needed Mysql by IntrovertedGuru(m): 6:11am On Jul 07, 2019
Doughboysss:



use a for loop or foreach

eg

foreach($records as $record){
$name[] = $record->name;
}


Hi bro, I’d like to connect with you offline. Please can I have your contact? I’m on WhatsApp with 0803892eighty56
Re: Help Needed Mysql by Doughboysss: 11:32am On Jul 07, 2019
IntrovertedGuru:



Hi bro, I’d like to connect with you offline. Please can I have your contact? I’m on WhatsApp with 0803892eighty56

I sent u a message wit my WhatsApp number

(1) (Reply)

Ultimate & Short Guide To Stop Procrastinating / How Do Webmasters Create Sport Streaming Website? / My Future Is At Stake! Expert Advice Needed

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 11
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.