-
Posts
907 -
Joined
-
Last visited
Everything posted by searls03
-
I do still need some help with making it delete from the server, I have no idea or anything on how this code would look. sorry. could you help me with code or give me some links or something?
-
sorry, here is the code that pulls things from database(ignore $content please: <?php include_once "connect_to_mysql.php"; // if no id is specified, list the available articles $query = "SELECT image, event, name, id, site FROM pictures where id='".$_GET['id']."'"; $result = mysql_query($query) or die('Error : ' . mysql_error()); // create the article list while($row = mysql_fetch_array($result, MYSQL_NUM)) { list($image, $event, $name, $id, $site) = $row; $content .= "<input name=\"check[]\" type=\"checkbox\" value=value='".$row['userid']."' /><li><img src='$image'/></a></li>"; } ?> When I referred to row, I was referring to the table column from the database, not the result. and yes, I would like it to select from one column and spit all it out. sorry for confusion, I forget that people cant read my mind. haha.
-
I have never tried this before, but I must now.....how do I make a select list that will display all results from the table pictures but I only need the row "event". make sense? please help?
-
i don't know where the last picid comes from.....here should show what you need.....what should picid be? <?php include_once "connect_to_mysql.php"; // if no id is specified, list the available articles $query = "SELECT image, event, name, id, site FROM pictures where id='".$_GET['id']."'"; $result = mysql_query($query) or die('Error : ' . mysql_error()); // create the article list while($row = mysql_fetch_array($result, MYSQL_NUM)) { list($image, $event, $name, $id, $site) = $row; $content .= "<input name=\"check[]\" type=\"checkbox\" value=value='".$row['userid']."' /><li><img src='$image'/></a></li>"; } ?> <?php if ($_POST[submit]){ foreach ($_POST[check] as $key => $value) { $checkup = $_POST['check'][$key]; $q = "DELETE * FROM pictures WHERE id ='.$id.' AND LIMIT = '1'"; $sql = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error());} } ?>
-
sorry bout that.......just trying to get a template worked out......
-
so here is what I have come up with.......and I don't know how to write the delete query. <?php if ($_POST[submit]){ foreach ($_POST[check] as $key => $value) { $checkup = $_POST['check'][$key]; $q = "UPDATE pictures SET"; $sql = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error());} } ?> but like I said, I have no idea how to write arrays, this is just based off an example I found.
-
if you couldn't read, I am not good at array codes.......could you please post a link to the phpmanual as to where to start.....I searched arrays on it but it comes back with too many links and I don't know what to choose. please help
-
sorry, I would have put that in later.....but yes, I would have. sorry about that. any other help?
-
oh yea, one more thing.....it deletes from table called "pictures", which contains a url to the picture on this site, but if I could get the url and the picture to delete, in a directory called "images".......that would be the best!!!!!
-
ok, so I need to know how I can write a code for this <?php include_once "connect_to_mysql.php"; // if no id is specified, list the available articles $query = "SELECT image, event, name, id, site FROM pictures where id='".$_GET['id']."'"; $result = mysql_query($query) or die('Error : ' . mysql_error()); // create the article list while($row = mysql_fetch_array($result, MYSQL_NUM)) { list($image, $event, $name, $id, $site) = $row; $content .= "<input name=\"check[]\" type=\"checkbox\" value=\"\" /><li><img src='$image'/></a></li>"; } ?> so that when the checkbox is checked, the image that it is by will delete when I select a button called delete(not in code yet). I am pretty sure I need an array, but I am not good with arrays. Could you help me with this?
-
so like this? <?php include_once "secure/connect_to_mysql.php"; $uploaddir = 'images/'; $id= $_GET['id']; $event= $_GET['name123'] = str_replace(".", " ", trim($_GET['name123'])); $site = $_GET['site'].".php"; $template = 'template.php'; $basic = 'basic.php'; $standard = 'standard.php'; $picture = '$event.png'; $target_path = "images/"; $file = $uploaddir . basename($_FILES['uploadfile']['name']); $size=$_FILES['uploadfile']['size']; if($size>999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999) { echo "error file size > 1 MB"; unlink($_FILES['uploadfile']['tmp_name']); exit; } if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file)) { echo "success"; $sql = "INSERT INTO pictures(image, name, id, event, site) VALUES('$file', '$file', '$id', '$event', '$site')"; $rs = mysql_query($sql) or die ("Problem with the query: $sql<br>" . mysql_error()); echo mysql_error(); } else { echo "error ".$_FILES['uploadfile']['error']." --- ".$_FILES['uploadfile']['tmp_name']." %%% ".$file."($size)"; $picture_name = pathinfo($picture, PATHINFO_FILENAME); } copy($template, "$site"); copy($basic, "basic$site"); copy($standard, "standard$site"); mkdir("/events/$event", 0700); ?>
-
can I also use this to make directories? if so, How??????
-
is this how I would do it? $event= $_GET['name'] = str_replace(".", " ", trim($_GET['name']));
-
sorry, but how exactly can I put that in my code where the $_GET['name'] would replace the "." for me? I know original code said name123
-
sorry, I would have modified post, but it has been too long and I wanted to add this.......... I don't know if those are even what it is that I should use or if those are even anything close to what I do. any help is appreciated.
-
ok, so I have heard of ereg replace, preg replace, etc. which should I use. I want to get the value of a name from the URL and replace all "." in the name with a space. URL........site.com/page.php?name=me.hi, so how can I modify this code so that the "." will replace with a space or " " before it submits???? <?php include_once "secure/connect_to_mysql.php"; $uploaddir = 'images/'; $id= $_GET['id']; $event= $_GET['name123']; $site = $_GET['name123'].".php"; $template = 'template.php'; $picture = '$event.png'; $target_path = "images/"; $file = $uploaddir . basename($_FILES['uploadfile']['name']); $size=$_FILES['uploadfile']['size']; if($size>999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999) { echo "error file size > 1 MB"; unlink($_FILES['uploadfile']['tmp_name']); exit; } if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file)) { echo "success"; $sql = "INSERT INTO pictures(image, name, id, event, site) VALUES('$file', '$file', '$id', '$event', '$site')"; $rs = mysql_query($sql) or die ("Problem with the query: $sql<br>" . mysql_error()); echo mysql_error(); } else { echo "error ".$_FILES['uploadfile']['error']." --- ".$_FILES['uploadfile']['tmp_name']." %%% ".$file."($size)"; $picture_name = pathinfo($picture, PATHINFO_FILENAME); } copy($template, "$event.php"); ?>
-
how can I modify this code so that it pulls all results from database, but if $event has duplicates, it wont display all the extras, only one? <?php // Query member data from the database and ready it for display include_once "secure/connect_to_mysql.php"; if(!isset($_GET['id'])) { $query = "SELECT image, event, name, id, site FROM pictures"; $result = mysql_query($query) or die('Error : ' . mysql_error()); // create the article list while($row = mysql_fetch_array($result, MYSQL_NUM)) { list($image, $event, $name, $id, $site) = $row; $content .= "<li><a href='$site'>$event</a></li>"; }} ?>
-
I was posting to wrong directory.......it working fine.
-
do you see anything wrong in this code.....all of the sudden it stopped posting to database...... <?php include_once "secure/connect_to_mysql.php"; $uploaddir = 'images/'; $id= $_GET['id']; $event= $_GET['name123']; $site = "{$event}.php"; $file = $uploaddir . basename($_FILES['uploadfile']['name']); $size=$_FILES['uploadfile']['size']; if($size>999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999) { echo "error file size > 1 MB"; unlink($_FILES['uploadfile']['tmp_name']); exit; } if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file)) { echo "success"; } else { echo "error ".$_FILES['uploadfile']['error']." --- ".$_FILES['uploadfile']['tmp_name']." %%% ".$file."($size)"; } $sql = "INSERT INTO pictures(image, id, event) VALUES('$file', '$id', '$event')"; $rs = mysql_query($sql) or die ("Problem with the query: $sql<br>" . mysql_error()); echo mysql_error(); ?>
-
how can I basically do this? $event= $_GET['name123']; $site = '$event.php'; where $site = the get name123 with .php on it?
-
pull info for posting from javascript code area
searls03 replied to searls03's topic in PHP Coding Help
or is it not possible because it is not marked as a form? how could I implement that into the js then so that it submits when the document uploads?????make sense? -
I don't believe this is js help, so I put it here.....how do I pull the form field "id" and post to the database from this code? $(function(){ $('#swfupload-control').swfupload({ upload_url: "upload-file.php", file_post_name: 'uploadfile', file_size_limit : "9999999999999999999999999999999999", file_types : "*", file_types_description : "Image files", file_upload_limit : 1000, flash_url : "js/swfupload/swfupload.swf", button_image_url : 'js/swfupload/wdp_buttons_upload_114x29.png', button_width : 114, button_height : 29, button_placeholder : $('#button')[0], debug: false }) .bind('fileQueued', function(event, file){ var listitem='<li id="'+file.id+'" >'+ 'File: <em>'+file.name+'</em> ('+Math.round(file.size/1024)+' KB) <span class="progressvalue" ></span>'+ '<div class="progressbar" ><div class="progress" > ////////////////////////right here <input type="hidden" name="id" value="<?php echo $str; ?>" /></div></div>'+ '<p class="status" >Pending</p>'+ '<span class="cancel" > </span>'+ here is the code that posts: <?php include_once "secure/connect_to_mysql.php"; $uploaddir = 'images/'; $id= $_POST['id']; $file = $uploaddir . basename($_FILES['uploadfile']['name']); $size=$_FILES['uploadfile']['size']; if($size>999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999) { echo "error file size > 1 MB"; unlink($_FILES['uploadfile']['tmp_name']); exit; } if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file)) { echo "success"; } else { echo "error ".$_FILES['uploadfile']['error']." --- ".$_FILES['uploadfile']['tmp_name']." %%% ".$file."($size)"; } $sql = "INSERT INTO pictures(image, id) VALUES('$file', '$id')"; $rs = mysql_query($sql) or die ("Problem with the query: $sql<br>" . mysql_error()); echo mysql_error(); ?>
-
K, got it working the way I would like.....sorta.
-
no, i didn't write the genRandomString() code. the other piece I also found, but I made changes and added on to it......
-
its like that because that is just a code I had found. do you mean that I can pass that inside the javascript? or how do I do it?????