PHP - Mysqli Results Split Over 2 Divs ...
Hello:
I am having a brain fart on how to get this done and any ideas would greatly be appreciated. I am working on a in-house mailbox project and have my first problem. I am going to try and explain this a simple as possible as putting the words from my head to screen harder than I thought. I have a page with 1 div called msgs_main. Inside of that div are 2 more, top one called msgs_msgs and the bottom called msgs_content. The msgs_msgs div contains a simple mysqli query displaying the records that correspond to the user. What I want/need is that when the user clicks one of the rows, the contents of the message are displayed in the msgs_content div. I could provide the code, if it helps, but I am not really looking for answered code, but a process to learn from, like. "First, get a join and have all the records display in the msg_msgs div. Display them all to see that all the data is there. Later in production, remove the un-necessary fields from top div". Then research .... etc Similar TutorialsI'm getting the number of friends in each STATE. How do I split the results in $returnS? $query = "SELECT statez, COUNT(statez)FROM abs GROUP BY statez"; $results = mysql_query($query); $returnS=""; while($line = mysql_fetch_array($results)) { $returnS.= $line['COUNT(statez)'].",,".$line['statez'].",,,"; } echo $returnS; mysql_close($link); ?> I'm trying to work with prepared statements, but unfortunately I do not get any result back. I also tried while($stmt->fetch()) { ... }, with the same effect.
Does anyone have a suggestion?
Thanks in advance.
<?php MAKING CONNECTION if ($stmt = $mysqli->prepare("SELECT year FROM SOMETABLE WHERE id = ? LIMIT 1")) { $id = $_GET['id']; $stmt->bind_param("i", $id); $stmt->execute(); $stmt->bind_result($year); $stmt->fetch(); echo $year; $stmt->close(); } $mysqli->close(); ?> Hi. I will try and explain simply.
I have a list of item codes eg.
size1 Acolor1
size1 Bcolor3
size1 Bcolor1
size1 Acolor3
size1 Acolor4
size2 Acolor1
size3 Bcolor1
size3 Bcolor2
size3 Bcolor2
size3 Acolor1
I want to take these and split them into parts:
size1 Acolor2
size1 Bcolor3
etc.
Then I want to create a form with 2 dropdowns. The first option would just have all unique sizes so:
size1
size2
size3
Then when one is selected, option 2 would show the colours available in that size.
Is there a standard way of doing this? Can I use PHP to create the array and then jquery to display and hide the options?
I'm totally stuck and i'm not just looking for somebody to code it all for me. any help would be greatly appreciated
thanks
Sam
I've been trying to figure out how to split up strings such as the following: A54a1, 23b, FX49s1, R231z, 77 I would like to split them up and add them to individual arrays that are as follows: index[0] -> alphabetical characters, if any, prior to the first number, if any index[1] -> numerical characters, as a number, up until the following alphabetical character index[2] -> alphabetical character(s), if any index[3] -> numerical characters following the second alphabetical character set, if any So, for example, the above strings would be separated like this: A54a1 == ('A', 54, 'a', 1) 23b == (, 23, 'b',,) FX49s1 == ('FX', 49, 's', 1) R231z == ('R', 231, 'z',,) 77 == (,77,,) I've looked into things like strpos(), but I can't figure how to determine whether a character is alphabetic or numeric. And yes, I am familiar with the function is_numeric(). Just don't know how to throw it all together to accomplish what I need. Hi all, hopefully just a quickie. split is deprecated in 5.3, but i have the following to get working.. Code: [Select] $dest = split(self::__MAIL_DELIMITOR__, $this->_mails); delimitor is as follows: Code: [Select] const __MAIL_DELIMITOR__ = ',';and _mails is just a list of email addresses. Can anyone suggest a workaround? Thanks hi everyone, i have a string as this one: 45,3455,66,8900,2,49,88,8,909 I need to print it with a new line every 4 numbers, as this one: 45,3455,66,8900, 2,49,88,8, 909 How can i do this? many thanks I'm pulling 10 records here. How do I split the results in to several echos? $query = "SELECT statez, COUNT(statez)FROM mylist GROUP BY statez"; $results = mysql_query($query); $returnS=""; while($line = mysql_fetch_array($results)) { $returnS.= $line['COUNT(statez)'].",,".$line['statez'].",,,"; } echo $returnS; mysql_close($link); ?> I need the code to look like this by showing the (COUNT) number for each state. $results = mysql_query($query); while($line = mysql_fetch_array($results)) { echo $line["number_in_state1"].",,"; echo $line["number_in_state2"].",,"; echo $line["number_in_statee3"].",,"; echo $line["number_in_state4"].",,"; echo $line["number_in_state5"].",,"; echo $line["number_in_state6"].",,"; //etc.... } How do i specify that i want the fgetcsv() to use a ; to separate instead of a , p.s.(i have no control over the .csv file so i cant change it from ; to ,) What's the best string function to use if i want to split a string up affter a specific character? In this case i have a var with "uploads/thisImage.jpg" i want to split this so i can create a new var value of "thisImage.jpg" i have same problem like you, if i open a small file(3 to 5mb), open normal. But, when i try open a dbf file 13mb or more, cause php.exe error; i set Mem in php.ini to 256mb(before 8mb), but doens't work. Someone have some solution, because i try find some way to clipper program input data on MySQL and dont have sucess too... i have a set of array's with a similer layout as t127201103111200 what i need to do is split it like this t:1:27:2011:03:11:1200 (where the : is where i want the split but not add the : ). so i end up with this. $a = t $b = 1 $c = 27 $d = 2011 $e = 03 $f = 11 $g = 1200 what i think i need to do is Code: [Select] split(char1($a), char2($b), char3,4($c)...........................) but have no idea where to start. Thanks for any help I need to split a string, but in a very unusual way. $string1 = "HelloWorld" $string2 = "AlphaBravo" $string3 = "BreakMeUp" I need the following split at each upppercase letter for this output Hello World Alpha Bravo Break Me Up How can I split this data and then remove it? I need to split data by ; then split each one of those. $data = "page=1&data=1:21;2:34;5:57&a=yes"; So I will get: $category[0] = 1; $sub_category[0] = 21; $category[1] = 2; $sub_category[1] = 34; $category[2] = 5; $sub_category[2] = 57; I have a variable on my page called, $recipe['ingredients']; inside the var you have for example.... 100ml milk, 350ml double cream, 150ml water and so on. Now Im trying to split it up so it looks as follows <ul> <li>100ml milk</li> <li>350ml double cream</li> <li>150ml water</li> </ul> So far I have the following code..... $ingredientsParts = explode(',', $row_rs_recipes['ingredients']); $ingredients = array($ingredientsParts); while (! $ingredients) { echo" <li>$ingredients</li>";} But for some reason it doesnt work and I do not have the exp with explode to fix it. Quote A LOT better ways to secure passwords rather than md5'ing it and sticking it in the database if you want to look into them I thought md5'ing a password was the only option on making it more secure. Can point me in the direction of other SECURED options? What's the difference between str_split() and chunk_split()? They seem to perform the same task? I am trying to split a variable only if it has an integer. Here is what I want to do: $id = 1234-54678; should be split into and then placed into two variables: $id1 = 54678; $id2 = 1234; Sometimes the variable may not have a delimiter in which case I would like it to be $id1 example: $id = 54678; should go directly to $id1 = 54678; I am a php rookie and don't know which way is best to do this (explode, split, etc.) so I would appreciate any help you can give me. hello guys
i wand to split the 24h of a day to parts and select the time that i wand to start the 24h circle to count!
lets say
i give 2 int variables
$day_starts_to_count_from=00;
$split_day_to_parts=4;
so!
$hours_per_part = 24/$split_day_to_parts;
this gives me $hours_per_part = 6 (i split the 24h every 6hr)
how to know the part of my current hour?
lets say the system time is 15:35
how to find that im at the 3d part 12:00-18:00 if the 24h circle starts to count from 00:00
thanks in advance
Hi I am trying to split a form as shown in this simple code. I tried what I thought should work but obviously it is not working.
This submits the first part of the form but does not go to the second part of the form. So First name, Last names and Age are submitted but email and cell are not and it throws a undefined index warning for those.
Can someone please take a look at this and suggest if what I am trying to do can be accomplished using PHP.
Thanks
<?php if(isset($_POST['submit']) && $_POST['submit'] == 'Submit') { echo"<br> First Name = ".$_POST['fname']."<br>" ; echo"Last Name = ".$_POST['lname']."<br>" ; echo"Age = ".$_POST['age']."<br>" ; echo"Email = ".$_POST['email']."<br>" ; echo"Cell = ".$_POST['cell']."<br>" ; } ?> <html> <head> <title> WOW </title></head> <body> <table> <form id="form1" action = "splitform.php" method="post"> <th> TEST </th> <tr><td>First Name : </td> <td><Input type='text' name = 'fname'></td></tr> <tr><td>Last Name : </td> <td><Input type='text' name = 'lname'></td></tr> <tr><td>AGE : </td> <td><Input type='text' name = 'age'></td></tr> </form> <form id ="form1" action = "splitform.php" method="post"> <tr><td>Email : </td> <td><Input type='text' name = 'email'></td></tr> <tr><td>Cell: </td> <td><Input type='text' name = 'cell'></td></tr> </form> <tr><td><Input type="submit" name = "submit" value = "Submit" form = "form1"></tr></td> </table> </body> </html> Hi all, I am working on the PHP to fetch the data from the database. I would like to fetch the filename only following by: email1.png email2.png email3.png my_inbox.png
When I try this: $mailbox_sql = 'SELECT * FROM ' . $mailfolder . ' WHERE email_id = ? AND message_id = ?'; $mailbox = $link->prepare($mailbox_sql); $mailbox->execute([$id,$message_id]); // set the resulting array to associative $row = $mailbox->fetch(PDO::FETCH_ASSOC); if (is_array($row)) { $attached = $row['attached_files']; $attached_files_name = explode('attid: ', $attached); }
I am getting this: 0 filename: email1.png 1 filename: email2.png 2 filename: email3.png 3 filename: my_inbox.png
Here is what I have stored in the database: attid: 0 filename: email1.png attid: 1 filename: email2.png attid: 2 filename: email3.png attid: 3 filename: my_inbox.png
Here is what I want to achieve: email1.png email2.png email3.png my_inbox.png
Can you please show me example how I could get the filename when I am fetching the data from the database? Thanks in advance. Edited January 18, 2020 by mark107 |