PHP - Pull Data Regardless Of The Username.
This is my code. Data is been pulled from db_faq and Db_2 and then match the records against each other using array_intersect(). And as you see the data from db_faq is been pulled based on the $username.
My question is how can I ignore the $username and match all rows in db_faq against the data in db_2? Basically I need to get the matching records between the 2 databases regardless of the username. $Array1 = array(); $Array2 = array(); $var1 = '$username'; $query1 = "SELECT * FROM db_faq WHERE username = '".$var1."'"; $result1 = mysql_query($query1); $score1 = mysql_fetch_assoc($result1); foreach (range('25','35') as $ltr) { $Array1[] = array($score1['roundzA' . $ltr]); } $var2 = 'new'; $query = "SELECT * FROM db_2 WHERE place = schedule"; $result = mysql_query($query); $score2 = mysql_fetch_assoc($result); foreach (range('25','35') as $ltr) { $Array2[] = array($score2['points' . $ltr]); } $count = array(); for($i=0;$i<count($Array1);++$i) { $count[$i] = count(array_intersect($Array1[$i],$Array2[$i])); } $countResult = array_sum($count); Similar Tutorials
Using Inline Php; <h1><font Color="000088">the Username <?php '.$username.' ?> Already Exists";</h1>
Hi, I want to pull data from db, where sometimes all rows and sometimes rows matching given "username". Here is my code:
//Grab Username of who's Browsing History needs to be searched. if (isset($_GET['followee_username']) && !empty($_GET['followee_username'])) { $followee_username = $_GET['followee_username']; if($followee_username != "followee_all" OR "Followee_All") { $query = "SELECT * FROM browsing_histories WHERE username = \"$followee_username\""; $query_type = "followee_username"; $followed_word = "$followee_username"; $follower_username = "$user"; echo "$followee_username"; } else { $query = "SELECT * FROM browsing_histories"; $query_type = "followee_all"; $followed_word = "followee_all"; $follower_username = "$user"; echo "all"; } }
When I specify a "username" in the query via the url: browsing_histories_v1.php?followee_username=requinix&page_number=1 I see result as I should. So far so good.
Now, when I specify "all" as username then I see no results. Why ? All records from the tbl should be pulled! browsing_histories_v1.php?followee_username=all&page_number=1 This query shouldv'e worked:
$query = "SELECT * FROM browsing_histories";
I need to pull all the mysql data by the order of it's date/time . How can I write the code? I'm using this as a serverside script and I'm not a php person. But i believe the below code will not pull the data. Will it work if I remove the text marked in red? $query = "SELECT * FROM sub_db WHERE the_code = '".$abc."'" ORDER BY timestampz ASC"; This is the link to pull the page http://127.0.0.1/kudos/?viewkudoid=### This is the kudo-function.php page function get_kudo_info($viewkudoid){ global $wpdb; $tablename=acikudos_table_name(); $viewsql = "SELECT * FROM $tablename WHERE kudoid='$viewkudoid'"; $viewresult = $wpdb->get_results($viewsql); #$vewrow = mysql_fetch_assoc($viewresult); return $viewresult; } This is the kudo-view.php page function show_kudos($viewkudoid) { global $wpdb; $viewkudoid = $_GET['viewkudoid']; $getthekudo = get_kudo_info($viewkudoid); if ($viewkudoid == $getthekudo['kudoid']) { echo 'Congratulations, you have successfully fixed it!'; } else { echo 'Everything is displayed'; } } add_shortcode( 'kudosview', 'show_kudos' ); I know the issue is right in front of me but I can not find it. I am getting an error on line 3 for the original code, so I need help there, but what I do have a question on is this: http://kaboomlabs.com/PDI/test2.php Code: [Select] <?php $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) $result = $mysqli_query("SELECT * FROM comp"); echo "<SELECT name='comp'>\n"; while($row = $result->fetch_assoc()) { echo "<option value='{$row['name']}</option>\n"; } echo "</select>\n"; $result_close(); ?> What I am attempting to do is two fold. 1. Using PHP create a pull down menu that grabs data from the database. 2. Have something in where after line three there is a dotted break, and then the rest of the list is shown. There are over 150 entities that go into this database, so the top 3 are going to be the most used, the rest are going to be in alphabetical order. Now the database has a auto-increment numbering system, the company name, address, phone number, and email if possible. I only want it to show the company name. Is this possible at all? This topic has been moved to Microsoft SQL - MSSQL. http://www.phpfreaks.com/forums/index.php?topic=347695.0 Hi guys Can someone help me about this: The php code can be revise username and password with CURL then check database and if username & password is correct return true else false. Thanks ISSUE. A User enters information into a form. If the 'username' is already taken, a 'message' in Red and with larger font-size will be returned, for example, "The username $username already exists." If the username is 'mattd' then the message should say, "The username mattd already exists." Within my php application, I have included 'inline html'. Here is part of the code: .... if (mysql_num_rows($query_run)==1) { // it will never = more than one because only //one user will or will not exist ?> <html> </body> <h1><font color="#FF0066">The username <?php echo $username; ?>already exists.</h1> </body> </html> <?php }else{ //start the registration process $query = "INSERT INTO `Names` VALUES .... 1. At one point I did get this: "The username mattd already exists." 2. But now I only get "The username already exists." I am not retrieving the $username variable. This screenshot is found he http://imgur.com/lIwLZ1G thanks. While we're on the subject, is there a way to ensure that the first letter of a name is captalized, and the rest lowercase? Or is this best handled later on, when the name is being used and called from the DB. PS: some of us comment are code as to WHAT we are doing because we're just not that good yet, and we need to explain it to ourselves. Hi all- I need some help figuring out a select query... I have a view made from two tables with a user ID as the common key. I need to retrieve all rows from the view where the email address is NOT equal to the session variable stated [EMAIL]. I built it using what I thought was a fairly simple query, and what it gives me back are any rows where the EMAIL field has a value (not equal to the session variable) which is fine.. but I ALSO need to get the other rows where the email field has NO value assigned to it currently. How can I write this? field1 / field2 10 / England 15 / Italy 20 / France 15 / France 30 / USA When searching for France: SELECT DISTINCT field2, field1 FROM $tableName would return a distinct value. I want to ensure it returns the highest value in field1. Something like this: SELECT DISTINCT field2 (but ensure returns highest field 1 value), field1 FROM $tableName On the home page I am having a problem pulling information from the MySql here is my code...and this is what I am trying to do... i am trying to pull 10 items from the database that have today's date...I am also trying to make the user name a link to a page called backpack.php where that page can use the user name that is clicked to retrieve more information. (the problem I am having is 10 results come up but it is a repeat of the same 10 results and when you click the link it doesn't show the user that is clicked info.) PLEASE someone help I have been trying to figure this out for the longest time. Code: [Select] <form action="backpack.php" method="post"> <?php // rows to return $limit=10; $idcount=10; $date = date('Y-m-d'); $count = 0; while ($limit>=$count) { //open database $connect = mysql_connect("hostname","uname","pass") or die("Not connected"); mysql_select_db("db_name") or die("could not log in"); $query = "SELECT *,COUNT(name) FROM boox WHERE date='$date' ORDER BY date"; $idcount = $row['COUNT(name)']; $result = mysql_query($query); while($row = mysql_fetch_array($result)) echo "</br><table width='297' height='200' border='1' align='center' style='overflow:scroll'> <tr> <td width='152'>Book Title:</td> <td width='129'>$row[name]</td> </tr> <tr> <td>Author:</td> <td>$row[author]</td> </tr> <tr> <td>ISBN#</td> <td>$row[isbn]</td> </tr> <tr> <td>Date Posted:</td> <td>$row[date]</td> </tr> <tr> <td>Posted By:</td> <td><a href='backpack.php' onclick='document['packback'].submit()'>$row[username]</a></td> </tr> <tr> <td>School:</td> <td>$row[school]</td> </tr> </table></br>"; $count = $count + 1; $idcount = idcount + 1; } ?> </form> MOD EDIT: DB credentials removed, [code] . . . [/code] tags added. Hi firends, there is a store named "baslik". i try to creating photo gallery. i am saving photo and photo's name in database. Photo's name store named "baslik". Now, For example i am saving called "Summer Photos". i saved 10 photos. When i pull the images and names, all photos and names are pulling. I want to pull one image and its name from "baslik" store. "baslik" store's type "varchar" When i click the image's name, it should post other "Summer Photos". Image gallery should creating next to next like 1. image. And When i clicked the image, other images should open. For example when i clicked "meeting" image, it should go other "meeting" images. So, i want to categorize the images. You can look i put images.
I'm trying to create a mac widget that will display my college's football schedule. How do i get started pulling the table data of this page? or any webpage for that matter? It doesn't appear to wrapped in any kind of xml Code: [Select] http://www.aggieathletics.com/sports/m-footbl/sched/tam-m-footbl-sched.html The html is about 3/4 of the down in the source code. how do I call only a single column in a MySQL? This is not working. $SomeVar = $_POST['finco']; $query = "SELECT * FROM idb WHERE name = '".$SomeVar."'"; $results = mysql_query($query); $psend = $results["fincos"]; echo($psend); Good afternoon: I have added a database field to a table that has quiz questions in it. the field I have added is for images and I have entered the image url that is stored on the server in an image folder. Please could you tell me how I can include the image in the request by adding to the code below: $Questions = $DB->query("select * from ".TABLE_PREFIX."quiz_questions where q_forquiz='{$Quiz['qid']}' order by qqid"); while($Question = $DB->fetch_array($Questions)){ $Q[$Question['qqid']] = $Question; } Fields in table quiz_questions: qqid q_question q_type q_params q_forquiz q_questionimages - This is the field I added. Thank you for helping. Amilo anybody has any idea what the code is to put in a main image. So far i was able to find this but it pulls up all the images added in the album. I am only looking for the first image. Thank you. <ul class="thumbs thumbs_nocaptions"> <?php foreach( $this->paginator as $photo ): ?> <li> <a class="thumbs_photo" href="<?php echo $photo->getHref(); ?>"> <span style="background-image: url(<?php echo $photo->getPhotoUrl('thumb.normal'); ?>);"></span> </a> </li> <?php endforeach;?> </ul> I don't know that the subject describes exactly what I want to do so I will explain it as best as I can. I have a form that uses a select box to pull all the names of our employees from the database. I then have a submit button that opens up a page. The code from my view.php is as follows: <form onsubmit="return validateForm()" name="frmRequest" action="attendance.php" method="post" encytype="multipart/form-data"> Which employee would you like? <select> <? @ $db = mysql_connect("localhost", "db_user", "db_pass"); mysql_select_db("EmployeeInfo"); $strSQL = "SELECT Name FROM EmployeeInfo ORDER BY Name"; $rs = mysql_query($strSQL); $nr = mysql_num_rows($rs); for ($i=0; $i<$nr; $i++) { $r = mysql_fetch_array($rs); echo "<OPTION VALUE=\"".$r["Name"]."\">".$r["Name"]."</OPTION>"; } ?> </select> <input type="submit" class="submit" value="Submit" /> </form> On the attendance.php form, I need it to display that user that was pulled from the form on the page before. What would be the best way to do this? I am fairly new to PHP and i'm at a loss right now. Thanks, dmcdaniel hi all, i have a profile page which is a form that asks users to enter there personal details such as name, location, mobile number etc and saves this info with a mysql database, however when you return to the edit profile page the fields are blank and i want them to pull the details the user has entered (if any) and display it, so if a user entered there name as Lee, then returned to the edit profile page there name field would show lee instead of being empty. heres my profiles page code, any help would be great Code: [Select] <?PHP session_start(); if (!(isset($_SESSION['username']) && $_SESSION['username'] != '')) { header ("Location: login.php"); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Author: Reality Software Website: http://www.realitysoftware.ca Note: This is a free template released under the Creative Commons Attribution 3.0 license, which means you can use it in any way you want provided you keep the link to the author intact. --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <link href="style.css" rel="stylesheet" type="text/css" /> <style type="text/css"> .auto-style2 { font-size: 25px; } </style> </head> <body> <div id="container"> <!-- header --> <div id="header"> <div id="logo"><a href="#"><span class="orange">SouthWest</span> LAN's</a></div> <div id="menu"> <ul> <li><a href="index.php">home</a></li> <li><a href="register.php">Register</a></li> <li><a href="account.php">My Account</a></li> <li><a href="forum.php">Forums</a></li> <li><a href="faq.php">FAQ</a></li> </ul> </div> </div> <!--end header --> <!-- main --> <div id="main"> <div id="content"> <div id="head_image"> <div id="slogan"><strong><span class="auto-style2">Organising LAN Parties in the SouthWest</span></strong><br /></div> <div id="under_slogan_text"></div> </div> <div id="text"> <h1>Edit Profile</h1> <br /> <form name="register" method="post" action="process_p.php"> <table border="0" width="225" align="center"> <tr> <td width="219" bgcolor="#999999"> <p align="center"><font color="white"><span style="font-size:12pt;">Please fill out as much as possible</span></font></p> </td> </tr> <tr> <td width="219"> <table border="0" width="282" align="center"> <tr> <td width="116"><span style="font-size:10pt;">Username: </span></td> <td width="156"><?php echo $_SESSION['username']; ?></td> </tr> <tr> <td width="116"><span style="font-size:10pt;">Email: </span></td> <td width="156"><input type="text" name="email" maxlength="30"></td> </tr> <tr> <td width="116"><span style="font-size:10pt;">Real Name: </span></td> <td width="156"><input type="text" name="real_name"></td> </tr> <tr> <td width="116"><span style="font-size:10pt;">Location: </span></td> <td width="156"><input type="text" name="location"></td> </tr> <tr> <td width="116"><span style="font-size:10pt;">Mobile Number: </span></td> <td width="156"><input type="text" name="mobile_number"></td> </tr> <tr> <td width="116"><span style="font-size:10pt;">Instant Messager: </span></td> <td width="156"><input type="text" name="instant_messaging"></td> </tr> <tr> <td width="116"> </td> <td width="156"> <p align="right"><input type="submit" name="update" value="Update Profile"></p> </td> </tr> </table> I was wondering if anyone is aware of a php script that can pull html from a external site and create a local page with all the urls and image paths rewritten to local paths. I'm trying to create a module for Drupal that does this. Any script already written that I can adapt to Drupal would be great. If no one is aware of a current script that does this, can anyone point me in the right direction? Hi there all, I want to pull news feeds, from a web site and display them .... I have forgot what commands to use to do this. please help. Any example, i am most grateful. |