Jump to content

Search the Community

Showing results for tags 'help'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. hello i did a php message system where it get data from sql and it extracts the message that the person wrote you, but is separated into conversations so in the inbox i want it to show only the last message shown, witch it works ONLY for the first person that sends you a message not for the other persons that send you messages so i made a data base where conversation_hash is unique and you it has ids in string separated by a "," <?php $b = mysql_query("SELECT * FROM conversations"); while($a = mysql_fetch_array($B)){ $hash = $a['conversation_hash']; $ids = $a['ids']; $ids = explode(",", $ids); if(array_search($id, $ids) == true){ $ids = array_filter($ids, 'strlen'); foreach($ids as $o){ if($o !== $id){ print_r($ids); echo $o; $y = mysql_query("SELECT * FROM messages WHERE conversation_hash='$hash' AND from_id='$o' ORDER BY message_id DESC "); $t = mysql_fetch_array($y); ?> <div class="message"> <center> <table width="600"> <tr> <td width="75" rowspan="2"> <img src="/elitequorum/<?php echo $t['image_location']; ?>" height="75" width="75" /> </td> <td height="39"> </td> <td height="" rowspan="2"> <table height="75"> <tr> <td width="450" style="vertical-align:middle;" height="55"> <?php echo $t['message']; ?> </td> </tr> <tr> <td style="text-align:right; vertical-align:bottom;" height="5"> <?php echo $t['date']; ?> </td> </tr> </table> </td> </tr> <tr> <td width="75" height="34"> <?php echo $t['username']; ?> </td> </tr> </table> </center> </div> <?php } } } } ?> to do some testing if the information is getting where is suppost to i did some print_r(); and the information does go but it doesnt go in the SQL as a loop, i dont get any PHP/SQL error but the script is not working correctly, this is what i get: ---------------------------------------------------------------------- image1| Message1 | date2 | ----------------------------------------- broken(image2)| empty(message2) | empty(date2) | ---------------------------------------------------------------------------------------- And this is what im suppos to get: ---------------------------------------------------------------------- image1| Message1 | date2 | ----------------------------------------- image2| message2 | date2 |
  2. I keep getting error: PHP Error Message Warning: mysql_query() [function.mysql-query]: Access denied for user 'a6743732'@'localhost' (using password: NO) in /home/a6743732/public_html/chat.php on line 25 PHP Error Message Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/a6743732/public_html/chat.php on line 25 Access denied for user 'a6743732'@'localhost' (using password: NO) <?php session_start(); //CREDITS TO MODERNSONIC FROM 3DSPLAZA-3DSPAINT-SOMELUIGI.COM-3DSMEGUSTA-DSISTARZ for this chat script! //CREDITS TO MARIOERMANDO FOR THE TABLE CREATOR //CREDITS TO JUNAID FOR THE AUTO REFRESH...THAT WILL ONLY WORKS IF YOU SEPARATE THE MESSAGE FILE. ?> <? //AUTO TABLE CREATOR BY MARIOERMANDO //http://3DSFun.heliohost.org/ //http://marioermando.tumblr.com $sql = "CREATE TABLE chat( id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), user TEXT(30), message TEXT(40))"; $result = mysql_query($sql) or die(mysql_error()); ?> <script type='text/javascript'> function updateChat() { var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { document.getElementById("").innerHTML = xmlhttp.responseText; } } xmlhttp.open("GET",".php?error=",true); xmlhttp.send(); } </script> <body onload="setInterval('updateChat()',2000);"> <div id="chat" style="witdth:320px height:200px; overflow:auto;"> <?php $user = $_SESSION['username']; //database infos $con = mysql_connect("mysql10.000webhost.com","a6743732_pokeb","***********"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("a6743732_pokeb", $con); if ($_POST['submit']) { $_POST['message'] = mysql_real_escape_string(htmlentities($_POST['message'])); $sql = "INSERT INTO chat (user, message) VALUES ('$user', '$_POST[message]')"; $result = mysql_query($sql) or die(); } session_start(); if (!empty($_SESSION['username'])) // he got it. { echo ""; } else // bad info. { header('Location: connexion.php'); } //db connect $user = $_SESSION['username']; $con = mysql_connect("mysql10.000webhost.com","a6743732_pokeb","***********"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("a6743732_pokeb", $con); //max messages $result = mysql_query("SELECT * FROM chat ORDER BY id DESC LIMIT 0, 15"); while($row = mysql_fetch_array($result)) { //smilies $smIn=array("R:"); $smOut=array("EPIC FACE URL"); $o_user = $row['user']; $message = $row['message']; $message = str_replace($smIn, $smOut, $message); echo '<u>'. $o_user . '</u>: '. $message . '</font>'. '</font>'. '</b>' ; echo "<br>"; } ?> </div> <style> #chat { background-color:green; width:320px; height:200px; overflow:auto; } </style> <form action="chat.php" method="POST"> <input type="text" name="message"><input type="submit" value="Chat" name="submit"> </form> <meta name="viewport" content="width=320"> <br> <a href="index.php"><img src="[url="http://png-2.findicons.com/files/icons/1572/minicons/48/refresh.png%22></a>refresh"]http://png-2.findico...ng"></a>refresh[/url] <br> Chat! </body>
  3. hi i am creating a website where a user can post a title,upload an image, description of image and description of ad and with this i keep getting error writing to database could somebody help me with this code thanks. also i need to insert current date into the database thanks. <?php if ( !isset($_FILES['userFile']['type']) ) { die('<p>No image submitted</p></body></html>'); } ?> You submitted this file:<br /><br /> Temporary name: <?php echo $_FILES['userFile']['tmp_name'] ?><br /> Original name: <?php echo $_FILES['userFile']['name'] ?><br /> Size: <?php echo $_FILES['userFile']['size'] ?> bytes<br /> Type: <?php echo $_FILES['userFile']['type'] ?></p> <?php require 'mysql.php'; $title=$_POST['title']; $description=$_POST['description']; // Validate uploaded image file if ( !preg_match( '/gif|png|x-png|jpeg/', $_FILES['userFile']['type']) ) { die('<p>Only browser compatible images allowed</p></body></html>'); } else if ( strlen($_POST['altText']) < 9 ) { die('<p>Please provide meaningful alternate text</p></body></html>'); } else if ( $_FILES['userFile']['size'] > 16384 ) { die('<p>Sorry file too large</p></body></html>'); // Connect to database } else if ( !($link=mysql_connect($host, $user, $passwd)) ) { die('<p>Error connecting to database</p></body></html>'); } else if ( !(mysql_select_db($dbName)) ) { die('<p>Error selecting database</p></body></html>'); // Copy image file into a variable } else if ( !($handle = fopen ($_FILES['userFile']['tmp_name'], "r")) ) { die('<p>Error opening temp file</p></body></html>'); } else if ( !($image = fread ($handle, filesize($_FILES['userFile']['tmp_name']))) ) { die('<p>Error reading temp file</p></body></html>'); } else { fclose ($handle); // Commit image to the database $image = mysql_real_escape_string($image); $alt = htmlentities($_POST['altText']); $query = 'INSERT INTO image (title,type,name,alt,img,description,date) VALUES ("' . $title . '","' . $_FILES['userFile']['type'] . '","' . $_FILES['userFile']['name'] . '","' . $alt . '","' . $image . '","' . $description . '","' . $NOW() . '")'; if ( !(mysql_query($query,$link)) ) { die('<p>Error writing image to database</p></body></html>'); } else { die('<p>Image successfully copied to database</p></body></html>'); } } ?>
  4. The following code doesn't work can someone please help me out? <?php // Connects to your Database mysql_connect("db.xxxxxx.org", "xxxxxx", "xxxxxx") or die(mysql_error()); mysql_select_db("md212730db240041") or die(mysql_error()); //This code runs if the form has been submitted if (isset($_POST['submit'])) { //This makes sure they did not leave any fields blank if (!$_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] ) { die('You did not complete all of the required fields'); } // checks if the username is in use if (!get_magic_quotes_gpc()) { $_POST['username'] = addslashes($_POST['username']); } $usercheck = $_POST['username']; $check = mysql_query("SELECT username FROM users WHERE username = '$usercheck'") or die(mysql_error()); $check2 = mysql_num_rows($check); //if the name exists it gives an error if ($check2 != 0) { die('Sorry, the username '.$_POST['username'].' is already in use.'); } // this makes sure both passwords entered match if ($_POST['pass'] != $_POST['pass2']) { die('Your passwords did not match. '); } // here we encrypt the password and add slashes if needed $_POST['pass'] = md5($_POST['pass']); if (!get_magic_quotes_gpc()) { $_POST['pass'] = addslashes($_POST['pass']); $_POST['username'] = addslashes($_POST['username']); } // now we insert it into the database $insert = "INSERT INTO users (username, password) VALUES ('".$_POST['username']."', '".$_POST['pass']."')"; $add_member = mysql_query($insert); ?> It returns this error: Parse error: syntax error, unexpected $end in /public/sites/build2.mccity.org/Register.php on line 237 Thanks alot on forhand.
  5. i keep getting this error all the time i don't understand why this is happening could someone please help me. <?xml version="1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb"> <body> <h1>image upload to freecycle</h1><p> <?php require 'auth.php'; if(isset($_SESSION['loggedin'])){ //session is set, user is logged in }else{ header("http://stuweb.cms.gre.ac.uk/~sn027/login.html"); if ( !isset($_FILES['userFile']['type']) ) { die('<p>No image submitted</p></body></html>'); } ?> <body> <h1>Uploading Images to MySQL</h1><p> <?php if ( !isset($_FILES['userFile']['type']) ) { die('<p>No image submitted</p></body></html>'); } ?> You submitted this file:<br /><br /> Temporary name: <?php echo $_FILES['userFile']['tmp_name'] ?><br /> Original name: <?php echo $_FILES['userFile']['name'] ?><br /> Size: <?php echo $_FILES['userFile']['size'] ?> bytes<br /> Type: <?php echo $_FILES['userFile']['type'] ?></p> <?php require 'mysql.php'; // Validate uploaded image file if ( !preg_match( '/gif|png|x-png|jpeg/', $_FILES['userFile']['type']) ) { die('<p>Only browser compatible images allowed</p></body></html>'); } else if ( strlen($_POST['altText']) < 9 ) { die('<p>Please provide meaningful alternate text</p></body></html>'); } else if ( $_FILES['userFile']['size'] > 16384 ) { die('<p>Sorry file too large</p></body></html>'); // Connect to database } else if ( !($link=mysql_connect($host, $user, $passwd)) ) { die('<p>Error connecting to database</p></body></html>'); } else if ( !(mysql_select_db($dbName)) ) { die('<p>Error selecting database</p></body></html>'); // Copy image file into a variable } else if ( !($handle = fopen ($_FILES['userFile']['tmp_name'], "r")) ) { die('<p>Error opening temp file</p></body></html>'); } else if ( !($image = fread ($handle, filesize($_FILES['userFile']['tmp_name']))) ) { die('<p>Error reading temp file</p></body></html>'); } else { fclose ($handle); // Commit image to the database $image = mysql_real_escape_string($image); $alt = htmlentities($_POST['altText']); $query = 'INSERT INTO image (title,type,name,alt,img,description) VALUES ("' . $_FILES['userFile']['type'] . '","' . $_FILES['userFile']['name'] . '","' . $alt . '","' . $image . '")'; if ( !(mysql_query($query,$link)) ) { die('<p>Error writing image to database</p></body></html>'); } else { die('<p>Image successfully copied to database</p></body></html>'); } }
  6. <?php session_start(); if(!session_is_registered('myusername')){ header("location:main-login.php"); } ?> <html> <body> Login Successful </body> </html> i see error Deprecated: Function session_is_registered() is deprecated in C:\wampp\www\itvideohelps\login_success.php on line 4 Login Successful
  7. Notice: Undefined variable: subject in C:\wampp\www\itvideohelps\send_contact.php on line 5 Notice: Undefined variable: detail in C:\wampp\www\itvideohelps\send_contact.php on line 8 Notice: Undefined variable: customer_mail in C:\wampp\www\itvideohelps\send_contact.php on line 12 Notice: Undefined variable: name in C:\wampp\www\itvideohelps\send_contact.php on line 15 We've recived your contact information on this line script <html> <?php // Contact subject $subject ="$subject"; // Details $message="$detail"; // Mail of sender $mail_from="$customer_mail"; // From $header="from: $name <$mail_from>"; // Enter your email address $to ='octa@localhost'; $send_contact=mail($to,$subject,$message,$header); // Check, if message sent to your email // display message "We've recived your information" if($send_contact){ echo "We've recived your contact information"; } else { echo "ERROR"; } ?> </html> using localhost , i have install ArGoSoft mail server , and I did email settings outlook expresss help , thanks
  8. Dear all, I have some problem with my php code i try to make some XML and PHP Content managmant system, but i have now some problem with the root? He give the next error: Fatal error: Call to a member function root() on a non-object in /home/......./public_html/searchArticles.php on line 29 See here my code please: <?php session_start(); $results = array(); //this is a very simple, potentially very slow search function extractText($array){ if(count($array) <= 1){ //we only have one tag to process! for ($i = 0; $i<count($array); $i++){ $node = $array[$i]; $value = $node->get_content(); } return $value; } } $dh = opendir('./xml/'); while ($file = readdir($dh)){ if (eregi("^\\.\\.?$", $file)) { continue; } $open = "./xml/".$file; $xml = "domxml_open_file" .$open; //we need to pull out all the things from this file that we will need to //build our links $root = $xml->root("id"); $id = $root->get_attribute("id"); $stat_array = $root->get_elements_by_tagname("status"); $status = extractText($stat_array); $k_array = $root->get_elements_by_tagname("keywords"); $keywords = extractText($k_array); $h_array = $root->get_elements_by_tagname("headline"); $headline = extractText($h_array); $ab_array = $root->get_elements_by_tagname("abstract"); $abstract = extractText($ab_array); if ($status != "live"){ continue; } if (eregi($searchTerm, $keywords) or eregi($searchTerm,$headline)){ $list['abstract'] = $abstract; $list['headline'] = $headline; $list['file'] = $file; $results[] = $list; } } $results = array_unique($results); ?> <h1>Search Results</h1> <a href="index.php">back to main</a> <p>You searched for: <i><?php echo $searchTerm ?></i></p> <hr> <?php if (count($results)>0){ echo "<p>Your search results:</p>"; foreach ($results as $key => $listing){ echo "<br><a href=\"showArticle.php?file=".$listing["file"]."\">" . $listing["headline"]."</a>\n"; echo "<br>". $listing["abstract"]; echo "<br>"; } } else { echo "<p>Sorry, no articles matched your search term.</p>"; } ?> I hope for some sugestions, Thanks a lot!
  9. heres my code: $sql=" INSERT INTO `a8392424_pets`.`users` ( `user_id` , `user_name` , `user_pass` , `user_email` , `user_date` , `user_level` , `posts` , `married` , `cash` , `tokens` ) VALUES ( NULL, '" . mysql_real_escape_string($_POST['user_name']) . "', '" . sha1($_POST['user_pass']) . "', '" . mysql_real_escape_string($_POST['user_email']) . "', NOW(),'0', 'noone', '10000', '10')"; $result = mysql_query($sql); if(!$result) { //something went wrong, display the error echo 'Something went wrong while registering. Please try again later.'; //echo mysql_error(); //debugging purposes, uncomment when needed } When I execute it, using my signup form, the query fails. my connection to database is GOOD.
  10. <p>Hi, I am currently working on creating a code that grabs information from an array and places them into an html table. The only extra part is that I also have to separate the information within the array where there are colons and put them into separate table columns. I was able to create the code below, but just cant seem to get the tables to align or fit in the correct places. Any help or suggestion is really appreciated and thank you guys in advance.
  11. Hi Guys, From what I can tell, there is no other similar inquiry around... I'm completing my Higher School Certificate (final year of high school in New South Wales Australia) and I'm creating a web system for a major. Part of it requires me to have fully dynamic pages for my clients purpose, and I'm using database elements - so basically there is a BB Code site editor that translates [element=menu] to <?php elementCreate("menu"); ?> What I'm finding for some reason I can't contemplate, is that it's just blatantly not working! And when I use view source the <?php elementCreate("menu"); ?> is green as if it's a comment? function bbElement($transform){ $a = array( "/\[element=\"(.*?)\"\]/is", ); $b = array( "<?php echo elementCreate($1); ?>", ); $transform = preg_replace($a, $b, $transform); return $transform; } function elementCreate($element){ $element_fetch = mysql_query("SELECT * FROM `elements` WHERE `element_name` = '".$element."'")or die(mysql_error()); while($element_info = mysql_fetch_array($element_fetch, MYSQL_ASSOC)){ $econt = $element_info['content']; } return $econt; } It's quiet likely I've missed something simple - but all help is appreciated! Cheers.
  12. So basically I have a HUGE text file; download here or the code is like this; FirstName: Wayne, LastName: Brown, CommonName:None, Height: 185, DateOfBirth: Year: 1977, Month: 1, Day: 14, PreferredFoot: Right, ClubId: 1951, LeagueId: 61, NationId: 14, Rating: 54, Attribute1: 56, Attribute2: 53, Attribute3: 47, Attribute4: 61, Attribute5: 36, Attribute6: 49, Rare: 0, ItemType: PlayerGk but this is repeated like 11,480 times(to be exact) but with different information e.g names ect. I have the search working ATM like this; <?php $search = 'Wayne'; $lines = file('cleanedfutplayers.txt'); $found = false; foreach($lines as $line) { if(strpos($line, $search) !== false) { $found = true; echo $line; } } if(!$found) { echo "<i>No match found"; } ?> And atm I get a return of this; BUT i want to filter it out. I want it to just take the values such as getting the value of first name would just get Wayne and the same for the rest of the fields. and i also need some <br> 's in there and some spacing. So how would I go about filtering this? Also how would I add a search box and a button that would give and set the value of the; $search = ''; so for example i THINK the code will be something like this; echo "First Name: ", ['FirstName']; but it isnt because ive tested and it doesnt work? so PLEASE help me!
  13. I need some help from people who no how do to php, I want to make a website where a user submits a url under a category then it goes to the category page with 20 urls (that others submitted) and is posted there for 5 minutes then new urls people submitted are replaced there. there will be about 30 category that people can post in. please help i dont need no designing just code
  14. Hey all ,, I hope you are doing well,,, I just need a help in how to change the view of the menu page that is attached in this topic .. it's php script ,, the menu items shown horizontally and would like to make them vertically Thank in Advance menu.php
  15. Hello everyone. I know basics of html.But I dont know the <div> tag and its uses,functions. Please explain in detail. Thank you.
  16. I have the following code below. I have added buttons to each entry that pops up but I need the buttons to do certain things and I'm stuck. When the Approve button is pressed I want the entire entry to go to another table called "incomplete" (no quotations) and then I want the record to be deleted from the table "needs" (no quotations), which it currently resides in. When the Deny button is pushed I want the entry to just be deleted from the table "needs" (no quotations). Tried to figure it out on my own but I have nothing. I'm new to all this and the fact that I've gotten this far makes me excited :-) $query = mysql_query("SELECT * FROM needs"); while ($rows = mysql_fetch_array($query)): $firstname = $rows['firstname']; $lastname = $rows['lastname']; $address = $rows['address']; $city = $rows['city']; $state = $rows['state']; $phone = $rows['phone']; $email = $rows['email']; $typeofneed = $rows['typeofneed']; echo "$firstname $lastname<br>$address<br>$city $state<br>$phone<br>$email<br>$typeofneed<br>"; echo "<button name='approve' type='button'>Approve</button><button name='deny' type='button'>Deny</button><br>---------------------------<br>"; endwhile;
  17. We can create .php files every time I click on it will check to Simple "E: /e.txt" and read inside it and create / wirte to print .php file hosting We can create .php files every time I click on it will check to Simple "E: /e.txt" and read inside it and create / wirte to print .php file hosting?? , please help
  18. Can anyone provide their method of getting the results to show as a table as the results it showing now is an unreadable mess, I'd also like the following css styling as follows: Padding: 20px Border: 1px solid grey th to be in light grey Id be greatfull if someone could put the code into a table as its driving me nuts lol Here is the code for showing the results: $sql = "SELECT animal_type, animal_breed, colour, owner_name, address, telephone, mobile, email, offence, offence_date, offence_location, case_status, case_ref, action_required, action_taken, microchipped, microchip_number, aggressive, dangerous, lost, date_lost, location_lost, stolen, date_stolen, location_stolen, found, date_found, location_found, other_information FROM `animals` WHERE 1"; $result = $conn->query($sql); if ($result->num_rows > 0){ while($row = $result->fetch_assoc() ){ echo $row["animal_type"]." ".$row["animal_breed"]." ".$row["colour"]." ".$row["owner_name"]." ".$row["address"]." ".$row["mobile"]." ".$row["email"]." ".$row["offence"]." ".$row["offence_date"]." ".$row["offence_location"]." ".$row["case_status"]." ".$row["case_ref"]." ".$row["action_required"]." ".$row["action_taken"]." ".$row["microchipped"]." ".$row["microchip_number"]." ".$row["aggressive"]." ".$row["dangerous"]." ".$row["lost"]." ".$row["date_lost"]." ".$row["location_lost"]." ".$row["stolen"]." ".$row["date_stolen"]." ".$row["location_stolen"]." ".$row["found"]." ".$row["date_found"]." ".$row["location_found"]." ".$row["other_information"]."<br>"; } } else { echo "0 records"; }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.