Jump to content

oalvarado

Members
  • Posts

    15
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

oalvarado's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks for the fast reply Jessica & Barand, The reason I'm using php is because this is going to be my install script once my project is complete and ready to go live. As for my error well its below: The whole idea is pretty simple I think, when the form is submitted all info will be inserted in the first table named "listados" that will be the first process since the form allows image uploads the second process will get the id from the first table and the images from the tmp file and insert them into the second table as links to the files where they are located that's why the relation between them. When a user clicks on the listing the info will be displayed as well as a lightbox gallery, that gallery will be fed according to the second table "images" . I hope you guys understand what I'm trying to do. Thanks.
  2. Hello All I'm trying to create 2 tables with a relation between them but I keep getting syntax errors, I'm using phpmyadmin for my DB and the script I'm using is in php to create the tables. my code is below and the first table can be created with no issues but the second one is the one with the problem; can someone please help me with that? My code is below. <?php /* Connect to host & create DB */ // Attempt to connect to MaSQL & print out messages : if($dbc = @mysql_connect('localhost','root','')) { print'<p>Successfully Connected to MySQL.</p>'; //Handle the error if the DB could be selected: if(!@mysql_select_db('realstate')){ print '<p style="color: red;">Could not connect to DB because: <br />'.mysql_error().'.</p>'; mysql_close(); $dbc = FALSE; } }else{// Connection Failed print '<p style="color: red;">Could not connect to MySQL:<br />'.mysql_error().'.</p>'; } $query = 'CREATE TABLE listados (list_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, titulo VARCHAR(20), direccion VARCHAR(40) NOT NULL, colonia VARCHAR(20) NOT NULL, ciudad VARCHAR(30) NOT NULL, estado VARCHAR(20) NOT NULL, pais VARCHAR(20) NOT NULL, zip VARCHAR(10) NOT NULL, email VARCHAR(50) NOT NULL, accion VARCHAR(6) NOT NULL, inmueble VARCHAR(15) NOT NULL, regla1 VARCHAR(3) NOT NULL, superficie VARCHAR(15) NOT NULL, regla2 VARCHAR(3) NOT NULL, construccion VARCHAR(15) NOT NULL, recamaras DECIMAL(2,0), banios DECIMAL(3,1), cubiculos DECIMAL(3,0), moneda VARCHAR(3) NOT NULL, precio DECIMAL(10,2) NOT NULL, description TEXT NOT NULL, fecha DATETIME NOT NULL) ENGINE=InnoDB'; //Execute query if(@mysql_query($query)){ print '<p> The table has been crated.</p>'; }else{ print '<p style="color:red.">Could not create table because:<br />'.mysql_error().'.</p><p>The query being run was: '.$query.'</p>'; } $query = 'CREATE TABLE images (img_id BIGINT UNSIGNED NOT NULL, image1 LONGBLOB, image2 LONGBLOB, image3 LONGBLOB, image4 LONGBLOB, image5 LONGBLOB, image6 LONGBLOB, image7 LONGBLOB, image8 LONGBLOB) PRIMARY KEY (list_id) FOREIGN KEY (img_id) REFERENCE images(img_id) ENGINE=InnoDB'; //Execute query if(@mysql_query($query)){ print '<p> The table has been crated.</p>'; }else{ print '<p style="color:red.">Could not create table because:<br />'.mysql_error().'.</p><p>The query being run was: '.$query.'</p>'; } mysql_close();//close connection ?> Thanks in advance
  3. Hello everyone. First and foremost sorry if this question is posted in the wrong topic but its a mix from php and MySQL. The question in mind is using php, how do I get the files from the upload folder to go into a DB table, when the user uploads the images there is a min of one image and a max of 8; now those files need to go in a table but I'm somewhat confused if I need to create a new table for the images with one file per column or do I create a new column on the existing table holding all of the user's data and insert the files in that table. Practically the idea is below: the user fills out the form and in the form he/she uploads images and then submits the form the php side of the form starts the process of inserting the users info into the main table "listings" and uploads images to upload folder <-- done works properly. (my bright idea comes here but cant really understand how it would work) 2nd. process : get listing id from main table to crate new directory for images, then gets the uploaded images and places them in that directory, during the move operation it populates either the contemplated table for images or it inserts the images to main table, that way when a viewer opens the listing there is a image gallery for what ever the listing is for. I hope I didn't confused anyone here with my question and thanks in advance to whom ever can understand my way of thinking.
  4. Thanks guys for the help, I used javascript for this and it works like a charm, I know this is the php section but I think it will helpful for other ppl. so here is what I used: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <title>Show/Hide</title> <script type="text/javascript"> // <![CDATA[ function display(obj,id1,id2,id3,id4,id5) { txt = obj.options[obj.selectedIndex].value; document.getElementById(id1).style.display = 'none'; document.getElementById(id2).style.display = 'none'; document.getElementById(id3).style.display = 'none'; document.getElementById(id4).style.display = 'none'; document.getElementById(id5).style.display = 'none'; if ( txt.match(id1) ) { document.getElementById(id1).style.display = 'block'; } if ( txt.match(id2) ) { document.getElementById(id2).style.display = 'block'; } if ( txt.match(id3) ) { document.getElementById(id3).style.display = 'block'; } if ( txt.match(id4) ) { document.getElementById(id4).style.display = 'block'; } if ( txt.match(id5) ) { document.getElementById(id5).style.display = 'block'; } } // ]]> </script> <script> // This adds 'placeholder' to the items listed in the jQuery .support object. jQuery(function() { jQuery.support.placeholder = false; test = document.createElement('input'); if('placeholder' in test) jQuery.support.placeholder = true; }); // This adds placeholder support to browsers that wouldn't otherwise support it. $(function() { if(!$.support.placeholder) { var active = document.activeElement; $(':text').focus(function () { if ($(this).attr('placeholder') != '' && $(this).val() == $(this).attr('placeholder')) { $(this).val('').removeClass('hasPlaceholder'); } }).blur(function () { if ($(this).attr('placeholder') != '' && ($(this).val() == '' || $(this).val() == $(this).attr('placeholder'))) { $(this).val($(this).attr('placeholder')).addClass('hasPlaceholder'); } }); $(':text').blur(); $(active).focus(); $('form:eq(0)').submit(function () { $(':text.hasPlaceholder').val(''); }); } }); </script> <body> <form method="post" action=""> <label for="titulo" id="label">Titulo de Listado: </label> <input type="text" class="input-left" placeholder="Ave. Jalisco #560" name="titulo"> <br /> <label for="Direccion" id="label">Direccion: </label> <input type="text" class="input-left" placeholder="Ave. Jalisco #560 Colonia Cacho Tijuana Baja California Mexico 22407" name="direccion"> <br /> <label for="email" id="label">Correo Electronico: </label> <input type="email" class="input-left" placeholder="123JuanCastro@Tucorreo.com" name="email"> <br /> <label for="accion" id="label">Accion Deseada: </label> <select class="input-left"> <option value="Vender">Vender</option> <option value="Rentar">Rentar: </option> </select> <br /> <label for="Descripcion" id="label">Descripcion del Inmueble</label> <br /> <textarea class="input-left" placeholder="Descripcion completa del inmueble" name="descripcion" rows=8 cols=30 style="max-width:400px; width:400px; height:150px; font-family:'sansation_light'; max-height:150px; overflow:auto; margin-top:10px; text-align: left;"></textarea> <br /> <label for="inmueble" id="label" >Tipo de Inmueble: </label> <select class="input-left" name="type" onchange="display(this,'Casa','Depto','Oficina','Nave','Terreno');"> <option>Sleccionar opcion:</option> <option value="Casa">Casa</option> <option value="Depto">Departamento</option> <option value="Oficina">Oficina</option> <option value="Nave">Nave Indust.</option> <option value="Terreno">Terreno</option> </select> <br/> <!-- option Casa --> <div id="Casa" style="display:none;"> <label for="cuartos" id="label">Cantidad de Recamaras: </label> <input type="text" class="input-left" placeholder="3" name="recamaras"> <br /> <label for="baños" id="label">Cantidad de Baños: </label> <input type="text" class="input-left" placeholder="1.5" name="baños"> <br /> <label for="Superficie" id="label">Superficie<sup>2</sup> de Inmueble: </label> <input type="text" class="input-left" placeholder="150" name="superficie" size="10"> <select class="input-left"> <option value="sqf">sqf</option> <option value="mts">mts</option> </select> <br /> <label for="construccion" id="label">Superficie<sup>2</sup> de Construccion: </label> <input type="text" class="input-left" placeholder="150" name="construcion" size="10"> <select class="input-left"> <option value="sqf">sqf</option> <option value="mts">mts</option> </select> <br /> <label for="precio" id="label">Precio: </label> <input type="text" class="input-left" placeholder="$1500" name="precio"> <select class="input-left"> <option value="MXN">MXN</option> <option value="USD">USD</option> </select> <br /></div> <!-- option Departamento --> <div id="Depto" style="display:none;"> <label for="cuartos" id="label">Cantidad de Recamaras: </label> <input type="text" class="input-left" placeholder="3" name="recamaras"> <br /> <label for="baños" id="label">Cantidad de Baños: </label> <input type="text" class="input-left" placeholder="1.5" name="baños"> <br /> <label for="Superficie" id="label">Superficie<sup>2</sup> de Inmueble: </label> <input type="text" class="input-left" placeholder="150" name="superficie" size="10"> <select class="input-left"> <option value="sqf">sqf</option> <option value="mts">mts</option> </select> <br /> <label for="construccion" id="label">Superficie<sup>2</sup> de Construccion: </label> <input type="text" class="input-left" placeholder="150" name="construcion" size="10"> <select class="input-left"> <option value="sqf">sqf</option> <option value="mts">mts</option> </select> <br /> <label for="precio" id="label">Precio: </label> <input type="text" class="input-left" placeholder="$1500" name="precio"> <select class="input-left"> <option value="MXN">MXN</option> <option value="USD">USD</option> </select> <br /></div> <!-- option Oficina --> <div id="Oficina" style="display:none;"> <label for="Oficina" id="label">Cantidad de Cubiculos: </label> <input type="text" class="input-left" placeholder="3" name="cubiculos"> <br /> <label for="baños" id="label">Cantidad de Baños: </label> <input type="text" class="input-left" placeholder="1.5" name="baños"> <br /> <label for="Superficie" id="label">Superficie<sup>2</sup> de Inmueble: </label> <input type="text" class="input-left" placeholder="150" name="superficie" size="10"> <select class="input-left"> <option value="sqf">sqf</option> <option value="mts">mts</option> </select> <br /> <label for="precio" id="label">Precio: </label> <input type="text" class="input-left" placeholder="$1500" name="precio"> <select class="input-left"> <option value="MXN">MXN</option> <option value="USD">USD</option> </select> <br /></div> <!-- option Nave Indust. --> <div id="Nave" style="display:none;"> <label for="Oficinas" id="label">Cantidad de Cubiculos: </label> <input type="text" class="input-left" placeholder="3" name="cubiculos"> <br /> <label for="baños" id="label">Cantidad de Baños: </label> <input type="text" class="input-left" placeholder="1.5" name="baños"> <br /> <label for="Superficie" id="label">Superficie<sup>2</sup> de Inmueble: </label> <input type="text" class="input-left" placeholder="150" name="superficie" size="10"> <select class="input-left"> <option value="sqf">sqf</option> <option value="mts">mts</option> </select> <br /> <label for="construccion" id="label">Superficie<sup>2</sup> de Construccion: </label> <input type="text" class="input-left" placeholder="150" name="construcion" size="10"> <select class="input-left"> <option value="sqf">sqf</option> <option value="mts">mts</option> </select> <br /> <label for="precio" id="label">Precio: </label> <input type="text" class="input-left" placeholder="$1500" name="precio"> <select class="input-left"> <option value="MXN">MXN</option> <option value="USD">USD</option> </select> <br /></div> <!-- option Terreno --> <div id="Terreno" style="display:none;"> <label for="Superficie" id="label">Superficie<sup>2</sup> de Inmueble: </label> <input type="text" class="input-left" placeholder="150" name="superficie" size="10"> <select class="input-left"> <option value="sqf">sqf</option> <option value="mts">mts</option> </select> <br /> <label for="precio" id="label">Precio: </label> <input type="text" class="input-left" placeholder="$1500" name="precio"> <select class="input-left"> <option value="MXN">MXN</option> <option value="USD">USD</option> </select> <br /></div> </form> </body> </html>
  5. Hi all, I'm trying to display 2 extra input tags if the user selects two options from a six option drop down in a form, so it would look like so: If option A,B selected = true, then echo 2 extra inputs, else if options C,D,E,F selected = false then do not display inputs. By the way I'm a beginner php programmer (need experience) so I coded my form with the php in the spots where need, DW does no display syntax error so I'm guessing is correct but when I preview in browser inputs show when they are not supposed to. Can someone please advice and if possible explain my problem,my code for the form is below: Thanks in acvance <form method="post" action=""> <label for="titulo">Titulo de Listado: </label> <input type="text" placeholder="Ave. Jalisco #560" name="titulo"> <br /> <label for="Direccion">Direccion: </label> <input type="text" placeholder="Ave. Jalisco #560 Colonia Cacho Tijuana Baja California Mexico 22407" name="direccion"> <br /> <label for="email">Correo Electronico: </label> <input type="email" placeholder="123JuanCastro@Tucorreo.com" name="email"> <br /> <label for="accion">Accion Deseada: </label> <select> <option value="Vender">Vender</option> <option value="Rentar">Rentar: </option> </select> <br /> <label for="Descripcion">Descripcion del Inmueble</label> <br /> <textarea placeholder="Descripcion completa del inmueble" name="descripcion" rows=8 cols=30 style="max-width:400px; width:400px; height:150px; font-family:'sansation_light'; max-height:150px; overflow:auto; margin-top:10px;"></textarea> <br /> <?php $do = 'Casa'; $do1 = 'Depto'; ?> <label for="inmueble">Tipo de Inmueble: </label> <select> <option>Seleccionar</option> <option value="Casa">Casa</option> <option value="Depto">Departamento</option> <option value="Oficina">Oficina</option> <option value="Terreno">Terreno</option> <option value="Nave">Nave Indust.</option> </select> <br /> <?php if ($do = true); echo '<label for="cuartos"># de Recamaras: </label> <input type="text" placeholder="3" name="cuartos">'; ?><br /> <?php if ($do1 = true); echo '<label for="baños">Cantidad de Baños: </label> <input type="text" placeholder="1.5" name="baños">'; ?><br /> <label for="Superficie">Superficie<sup>2</sup> de Inmueble: </label> <input type="text" placeholder="150" name="superficie"> <select> <option value="sqf">sqf</option> <option value="mts">mts</option> </select> <br /> <label for="construccion">Superficie<sup>2</sup> de Construccion: </label> <input type="text" placeholder="150" name="superficie"> <select> <option value="sqf">sqf</option> <option value="mts">mts</option> </select> <br /> <label for="precio">Precio: </label> <input type="text" placeholder="$1500" name="precio"> <select> <option value="MXN">MXN</option> <option value="USD">USD</option> </select> <br /> </form>
  6. Thanks again guys to all who helped out. My problem was with session_start() that was an easy fixed just giving the file a 777 permission
  7. Thanks alot guys to all who responded to my problem. the best answer to solve this problem was by PFMaBiSmAd, I now know where my problem is, apparently I have a session_start() problem. Warning: session_start() [function.session-start]: open(/var/lib/php/session/sess_ep254bt7v3n7a9ejfnludsnr00, O_RDWR) failed: Permission denied (13) in /var/www/vhosts/Pujasyganas.com/httpdocs/admin/install.php on line 1 Warning: Unknown: open(/var/lib/php/session/sess_ep254bt7v3n7a9ejfnludsnr00, O_RDWR) failed: Permission denied (13) in Unknown on line 0 Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/session) in Unknown on line 0 the new question is how to resolved this issue since I dont have a folder php in (var/lib) folder? Thanks again for all your help.
  8. Hello all; I'll start out with the hardware interface: VPS hosting @ myhosting . com --> Linux(CentOS) Parallels Plesk 10.4.4 Problem: I'm trying to host an auction on this server. My php.ini file is configured as per the instructions on the software, the installation for the software is done online you type in the following to install: yourdomain.com/admin/install.php. The installation is a series of five steps, 1. verify if server is supported. 2 DB creation. 3. LICENSE CHECK. 4. writing of config files 5. DB dump. Is there problems with this software or perhaps the server? Doing the install as per the instructions on step 3. the License check comes back as license failed. I found a way around that bypassing the license check, by the way I do have a license for it and a receipt that I paid for it. After modifying the software I'm able to get to step 4. writing of config files. When clicking o the next button (step 5) I get the following error on the browser: Database access error. Please contact the site administrator. UPDATE PHPAUCTIONXL_settings SET sitename='', siteurl='', adminmail='' Access denied for user 'xxxxxxxxx'@'localhost' (using password: NO) Well I am using a password to connect to the DB and I know the software (script) works fine because I tested it on my computer first using wamp and it installs with no errors. Anyways after speaking to the script developer he tells me that the server is the problem, even dough I change my php.ini file the host is restricting my f url open or that I might have a session variable issue at the server. Could that be true? Well I'm open to any suggestions or Ideas if someone here is willing to help the link to the install is below with the DB user and passwords. www.pujasyganas.com/admin/install.php -->l ink to install localhost user: xxxxxxx pwd: xxxxxx create new DB : auction License #: 6DF68320JY372946V If some one here is up to a challenge I'm open to upload the files or give acces to the server just let me know. Thanks in advance guys.
  9. Thank you Importune and all of you that helpe'd out. I'll install wammp and show it to the professor. Thanks again guys.
  10. I tried Impotune's code, I get the same blank page <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>variables</title> </head> <body> <?php // Script 2.3 - variables.php // An address: $street = "100 Main Street"; $city = "State College"; $state = "PA"; $zip = 16801; // Print the address. print "<p>The address is:<br />$street<br />$city $state $zip</p>"; ?> </body> </html> I dont know what else to do
  11. Thanks guys, I keep getting a blank page from the server, I think my problem is at the other end ( server) cause I've tried different editors in the past hour and I keep getting the same result. I've tried Notepad++, Alleycode and MS Expression Web 2 all with the same result, a blank page.
  12. ok I fixe'd it but no joy, same problem. I tried adding another ? to the following line: <?php? // Script 2.3 - variables.php my script changed color to red and blue and I was able to get a page on the browser to display address, street, city and zip but not the variables I needed.
  13. Thanks for the help. I just tried it the way you wrote the last line of the code, I still get the blank page. print "<p>The address is:<br />$street<br />$city $state $zip</P>"; ?>
  14. Hello all, I just started a class on MySQL and PHP. Im running Windows 7 pro and Expression Web 2 as an editor, I'm also using filezilla as FTP to acces my school's server. The issue: I work out my text book for my assigment; simply copy the code and summit, we use the server to check our work. When I upload a php file and try check my work i get a blank page, if I upload an HTML or XHTML file I'm able to see the web page with no problems. Here is a simple script out of the book which I get a blank page: [php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>variables</title> </head> <body> <?php // Script 2.3 - variables.php // An address: $street = "100 Main Street"; $city = "State College"; $state = "PA"; $zip = 16801; // Print the address. print "<p>The address is:<br />$street<br />$city $state $zip</P> </body> </html> ] [/code] Can Someone please help me out ? By the way I've tried different editors and I keep getting the same problems.
×
×
  • 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.