rondog
Members-
Posts
753 -
Joined
-
Last visited
Never
Everything posted by rondog
-
what if you just echo $sql . "<br/>"; ? What does it say?
-
you would simply use array_push to store the value <?php // Make a MySQL Connection $query = "SELECT Question, COUNT(Answer) FROM question1 GROUP BY Question"; $result = mysql_query($query) or die(mysql_error()); $values = array(); // Print out result while($row = mysql_fetch_array($result)){ echo "There are ". $row['COUNT(Answer)'] ." ". $row['Question'] ." items."; array_push($values,$row['COUNT(Answer)']); } // $values is now an array of data so continue with your script ?>
-
also make a new text field called cc and change the $_GET['cc'] to $_POST['cc']
-
since you are using $_GET['cc'], you should have that key pair in your URL bar. http://site.com/?cc=3452345234
-
alright I just wasn't sure if I HAD to do an include/require..guess I do, thanks
-
I have two classes: ## Admin.php <?php class Admin { public function __construct() { include("Config.php"); } /** * deletes a client * @returns true or false */ function deleteClient($id) { return mysql_query("DELETE FROM usernames WHERE id = '$id'"); } } ?> ## Projects.php <?php class Projects { public function __construct() { include("Config.php"); $this->admin = $admin; $this->dataFolder = $dataFolder; } /** * Deletes a project * @returns true or false */ function deleteProject($id) { $root = $_SERVER['DOCUMENT_ROOT']; $theDir = $root . $this->dataFolder; $sql = mysql_query("SELECT * FROM projectData WHERE proj_id = '$id'"); while ($row = mysql_fetch_array($sql)) { $mainFile = $row['path']; $thumb = $row['thumbnail']; if ($thumb != 'null') { unlink($theDir . "/" . substr($thumb,13)); } unlink($theDir . "/" . substr($mainFile,13)); } $delete = mysql_query("DELETE FROM projectData WHERE proj_id = '$id'"); $getDir = mysql_query("SELECT proj_path FROM projects WHERE id = '$id'"); $res = mysql_fetch_array($getDir); rmdir($theDir . "/" . $res['proj_path']); return mysql_query("DELETE FROM projects WHERE id = '$id'"); } } ?> How can I call deleteProject() from within Admin.php?
-
How do I save the image to the server? I am using this and this works for just displaying the thumbnail I am creating. <?php $src = $_FILES['Filedata']['tmp_name']; $img = imagecreatefrompng($src); $width = imagesx($img); $height = imagesy($img); $new_width = 141; $new_height = floor($height * ($new_width / $width)); $tmp_img = imagecreatetruecolor($new_width, $new_height); imagecopyresized($tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height); imagejpeg($tmp_img,NULL,40); imagedestroy($tmp_img); ?> edit::nvm imagejpeg is where its at
-
alright I'll go ahead and just save an actual thumbnail.
-
even if they're small thumbnails? My reason for doing this is when they delete the photo, it deletes the reference to the blob as well. I suppose I can delete the actual file by using the file name
-
maybe base64_encode? Shot in the dark here, hah
-
Flash can read byteArrays. Does PHP have a method that can convert say an uploaded image into a bytearray? I will be storing it into a longblob field in a DB. I plan to then read that bytearray back into flash and output it as an image. Here is the AS3 method of byteArray: http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/utils/ByteArray.html
-
when posting code, paste your code between (php) (/php) tags...replace the parens with brackets. It makes it much easier to read your code.
-
excellent, I think that will suffice
-
How do I check in PHP if something like the GD library is installed on a server? I am going to be making a thumbnailing system and the user can install the app on their server. If they have the GD library, continue with making thumbnails, else show a default thumbnail.
-
Interesting, I would have not guessed that.
-
I dont know what errors you are getting, but I am sure one of them is a 'Trim' error. It is 'trim', note the caps.
-
the only solutions I am finding require powerpoint to be installed on the machine. Alternatively someone suggested open office which should run fine on linux and has command line
-
<?php echo("<p>" . $commenttext . "<a href=\"adddelete.php?deletecomment=" . $commentid . "\" onclick=\"return confirm('Are you SURE you want to delete this comment?')\">Delete this Comment</a></p>"); ?>
-
I figured it out... the domain is a subdomain so $_SERVER['DOCUMENT_ROOT'] wasn't accurate. I had to include the document root + the subdomain folder. It is now working. Thanks for helping me.
-
ok I tried making it in the root directory like so (not quite the xxxxxx directory yet): <?php function createProject($dir) { $query = mysql_query("SELECT * FROM projects WHERE proj_path = '$dir'"); $num = mysql_num_rows($query); if ($num > 0) { return "folder already exists"; } else { $root = $_SERVER['DOCUMENT_ROOT']; $theDir = $root . $this->dataFolder . "/" . $dir; return mkdir($root . "/" . $dir,0755); } } ?> It returned true, yet I do not see it in the root. When I try and make it again it says file exists. This code works on my other server, I am guessing their is a weird config on this server going on
-
It is there and spelled correctly. It also has 755 permissions. I tried changing it to 777, but that didn't help.
-
I did I have it commented out in the method up top /home/content/c/s/8/cs8xo/html/xxxxxxx/project_data/testfolder2
-
I am trying to create a folder using amfphp using this method: <?php function createProject($dir) { $query = mysql_query("SELECT * FROM projects WHERE proj_path = '$dir'"); $num = mysql_num_rows($query); if ($num > 0) { return "folder already exists"; } else { $root = $_SERVER['DOCUMENT_ROOT']; $theDir = $root . $this->dataFolder . "/" . $dir; //return $theDir; -> "/home/content/c/s/8/cs8xo/html/xxxxxxx/project_data/testfolder2" return mkdir($theDir,0755); } } ?> I've commented out what $theDir returns when I pass it a $dir. $this->dataFolder == "/xxxxxxx/project_data" When I return the mkdir(), I get this error: (Object)#0 message = "faultCode:AMFPHP_RUNTIME_ERROR faultString:'mkdir(): No such file or directory' faultDetail:'/home/content/c/s/8/cs8xo/html/xxxxxxx/amfphp/services/clientlogin2/Projects.php on line 147'" name = "Error" rootCause = (null) Line 147 is referring to the mkdir() line. Can anyone spot anything obvious that I could be missing?
-
I tried using $value and it seems to be empty. If i echo $value its just blank
-
yeah sorry, I'll use the term radio button group rather than group next time to be more clear. Also, I wasn't aware you could define the HTML array index. That is very good to know. With your suggesting, this is what I ended up with and it works. Thanks for stickin through if (isset($_POST['savebtn'])) { foreach ($_POST['userlevel'] as $id => $value) { $query = mysql_query("UPDATE members SET userlevel = '" . $_POST['userlevel'][$id] . "' WHERE id = '" . $id . "'"); } }