PHP - Somethings Wrong With My Charset
Similar TutorialsHey everyone this is really really simple. say my site is www.mywebsite.com in my index page I have this define('PHPSITE_DIR', 'mywebsite'); require_once(PHPSITE_DIR . '/test/hello.php'); I have a folder named test and inside the folder i have hello.php but when i go to www.mywebsite.com i get Code: [Select] Warning: require_once(mywebsite/test/hello.php) [function.require-once]: failed to open stream: No such file or directory in wtf? i'm using godaddy server if that matters I guys, i´m seting up a template from themeforest for a customer, and i got to change the charset of the pages, it seems that everything was working, but to my surprise the text inside the h1 tags did not accepted the latin caracters, i`ve tryed everything but they still not changed, can you give me a hand?
Hi How can I make the data in phpmyadmin accept Arabic Language. Now Arabic language shows as question markss ?????????????. Is there anyway to do this via php? I searched online and seen some complex c and c# code which I didn't understand much of. But how do I generate an array with all string combinations based on length and from a charset? E.g. charset = {'a', 'b', 'c'} Length = 2. Then it should generate first all 1-char strings: a b c Then all 2-char strings: aa ab ac ba bb bc ca cb cc And then all added to the same array. I think there's some way of doing it with recursion but to me it's like thinking with a 4th dimension my mind can't grasp this logic! hi i am calling some text from a database with php and echoing it to flash. i have no idea the charset anything is in. all i can see is that calling the text from the database and placing into flash yields in some missing chars, but if echo the called text to the browser, copy it and echo that to flash, all characters appear. now, i kow this is not a flash forum, and im not going to ask for a flash solution because there's just too many different charsets and code i cannot control/ nor see so i was thinking of doing something along the line of having php creating a clone of the copied text that appears in the browser, and having it echo that text to flash. it there something php can do, similar to what i described? regards I am querying... $sql = "SELECT `messages_inbox`.`message_id`, `users`.`firstname`, `users`.`lastname`, `users`.`username` AS `from`, '${user_info['username']}' AS `to`, `subject`, LENGTH(`files`) AS `len`, 'inbox' AS `box`, DATE_FORMAT(`messages_inbox`.`time` ,'%T %D-%M-%Y') AS `time` "; $sql .= "FROM `messages_inbox` INNER JOIN `users` ON `messages_inbox`.`from_id` = `users`.`id` WHERE `to_id` = ${user_info['uid']} AND `messages_inbox`.`deleted` = 0 ORDER BY `messages_inbox`.`message_id` DESC"; and I am trying to output $displayName = ucwords("${message['firstname']} ${message['lastname']}"); by using $messages = pm_fetch_all($_GET['box']); I know my fetch works but for some reason firstname and lastname are only returning the logged in users first name and last name, not the person who sent the message. I am trying to create a very basic object but am having troubles. Code: [Select] <?php class item{ public $name; public $price; function __construct($name,$price){ $this->name=$name; $this->price=$price;} function getName(){ return $this->name; } } $object = new item("car",400); echo $object->getName(); ?> The HTML output is: name=$name; $this->price=$price;} function getName(){ return $this->name; } } $object = new item("car",400); echo $object->getName(); ?> I'm sure that this code is clean but for some reason will not output the desired result! any help would be great. thanks. Hi all. I always create my sql queries like below. $user = "user"; $pass = "123456"; $host = "localhost"; $base = "test"; $cn = mysql_connect($host, $user, $pass) or trigger_error("SQL", E_USER_ERROR); mysql_select_db($base,$cn) or trigger_error("SQL", E_USER_ERROR); $QUERY = mysql_query("SELECT id FROM someTable", [size=14pt][color=red][b]$cn[/b][/color][/size]) or die(mysql_error()); while ($list = mysql_fetch_assoc($QUERY)){ echo "Some Text over loop"; } Okay here is the question (or problem). What if i have 5000 records in my Table. Doesn't this code connect DB 5000 times? If yes, then how can i optimize it? I did a big upgrade to my CMS and now the editing of an upload doesn't seem to work. The id is pulled from a list on the previous page and is functional. Here is the form: $id=$_GET['id']; $data = mysql_query("SELECT * FROM headerimg WHERE id = '$id'") or die(mysql_error()); while($info = mysql_fetch_array( $data )) { echo " <div id='edit'> <form method='post' action='headerimgeditprocess.php?id=".$id ."' enctype='multipart/form-data'> <fieldset> <legend>".$info['title'] ."</legend> <table> <tr><td colspan='2' style='text-align:center'><img src='../upload/headerimg/".$info['image'] ."' width='300'><br /><br /></tr></td> <td> Title:</td> <td> <input type='text' name='title' value='".$info['title'] ."'> </td></tr> <tr><td> Image: </td><td> <input type='file' name='image'></td></tr> </table> <br/> <br/> <input TYPE='submit' name='upload' title='Add data to the Database' value='Submit'/> </fieldset> </form> Here is the processor: $target = "/var/chroot/home/content/87/6409087/html/upload/headerimg/"; //This gets all the other information from the form $title=$_POST['title']; $id=$_GET['id']; if ($image != ''){ $image = ($_FILES['image']['name']); foreach($_FILES as $file) { move_uploaded_file($file['tmp_name'], $target . $file['name']); } mysql_query("UPDATE headerimg SET image ='$image' WHERE id ='$id'"); } //Writes the information to the database mysql_query("UPDATE headerimg SET title = '$title' WHERE id ='$id' "); ?> <p>Update Successful... <a href="../main.php">click here</a> to return to the administration area.</p> $result3 = mysql_query("SELECT User_ID FROM leaderboards WHERE User_ID = '$user'"); if(mysql_num_rows($result3) == 0){ $query1 = "INSERT INTO leaderboards (User_ID, CollegeFootballPoints) VALUES ('$user','$points')"; $result1 = mysql_query($query1); }else{ $query2 = "UPDATE leaderboards SET CollegeFootballPoints='$points' WHERE User_ID='$user'"; $result2 = mysql_query($query2); } I keep getting this error...' Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in update_collegeFBpoints_points.php on line 40 And the script is not working! (LINE 40 is $result3 = mysql_query("SELECT User_ID FROM leaderboards WHERE User_ID = '$user'"); if(mysql_num_rows($result3) == 0){ specifically mysql_num_rows) When the webpage loads it inserts all its information via xml into the database. This all works fine and perfect untill i reload the page again then it starts screwing up all the data im not sure what im doing wrong i know this isnt much info but is there a common mistake im making? Ok I have this code.. it logs into my myspace accounts and grabs some info.. it is supposed to log into each account and write the info to a file.. what it does is logs into the first account and writes the info to the file then when it signs into the second account it doesnt write the info on the new line it just overwrites the info from the previous account.. here is some of the code for($i=0; $i!=count($account_data); $i++){ echo "\n::: ".strtoupper($account_data[$i][0])." :::\n"; if($account_data[$i][1] != "" && stristr($account_data[$i][0], "@") && stristr($account_data[$i][0], ".")){ list($place[0],$place[1],$place[2],$place[3]) = authorize($account_data[$i], $game_link); if($place[2] > 1 && strlen($place[3]) == 40){ $filename = 'auth-keys.txt'; $fp = file($filename,'a+'); $data = $place[2]." ".$place[3]."\r\n"; file_put_contents($filename, $data); echo $data;}}} sleep(10000); heres a pic Any help would be greatly appreciated |