|
-
cyrillic characters
Date: 06/06/06
(PHP Community) Keywords: mysql, database, sql
this has been driving me mad for several hours now :(
how on earth do I convert cyrillic characters into something that can be safely stored and retrieved from a mysql database?
From playing around with wordpress etc, I know I need to do this:
привет -> привет
but I have no idea what function(s) to use. Thanks :)
Source: http://community.livejournal.com/php/458161.html
-
PHP Book
Date: 06/07/06
(PHP Community) Keywords: php, programming, mysql, sql, linux, apache
Hello Friends
I am a programmer in a Linux/Apache/MySQL/PHP shop. I also do some Windows programming in Delphi and have done lots of other stuff academically.
I'm looking for a book on PHP that will help me with "bigger picture" and "higher level" design considerations. I'm looking for a book that contains complete solutions and ideas for solving medium to large problems. Object-oriented designs are a big plus.
I'm also looking for a great reference manual.
I've been poking around looking at reviews, but I would like to have the opinions of some serious PHP programmers first.
Thank you!
Source: http://community.livejournal.com/php/458470.html
-
Matching a variable against several options
Date: 06/08/06
(PHP Community) Keywords: php, mysql, sql
In MySQL there is a way to do this:
SELECT something FROM tablename WHERE something IN (2,3,4,5,6);
Is there a way to do the same with PHP (the logic, not the query)?
Source: http://community.livejournal.com/php/458704.html
-
Sanitizing user data for database usage
Date: 06/09/06
(PHP Community) Keywords: mysql, sql
I know it's an age-old question, but I just wanted your opinions on it: How should I be santizing my data before using it in my MySQL queries so as to prevent against nasties like SQL injection attacks?
At the moment I'm using the function below - is this sufficient?
Thanks in advance. :)
/* safeVar Function Rids variables of nasty characters
$var = safeVar ($var);
*/ function safeVar ($value) { // stripslashes if (get_magic_quotes_gpc ()) { $value = stripslashes ($value); }
// Quote if not integer if (!is_numeric ($value)) { $value = "'" . mysql_real_escape_string ($value) . "'"; }
return $value; }
Source: http://community.livejournal.com/php/458935.html
-
I think I need help. Sorry~
Date: 06/19/06
(WebDesign) Keywords: php, mysql, database, sql, web
Hi I recently asked your opinions on my site, groovescapeonline.net! Well, I really don't think this is the place to do it, and i'll just delete the post once I get in trouble for it (if this isn't in fact the place for it)-- But would anybody here be willing to help me in creating some sort of database that users upload information to? I've looked all around the net, looked at all sorts of scripts (some worked, some didn't, and then-- ahhhh).
There's a thing on this website ( http://ddrfreak.com ) -- If you go to "machine locations", users submit locations of machines and they go up in an organized fashion. (I'm not looking for something that complicated or as complicated---) OR-- like a site like www.bemanistyle.com -- how users are able to submit "simfiles" (a zip file, i guess), which posts itself in a searchable database.
I just wanted some tips or maybe somebody's assistance on how I would create something like this. I have a MySQL database thing for my forum (phpbb)-- and I just want to make a database of some sort, that users could either submit files to a searchable extent-- OR just to submit locations (for another site of mine: http://piuzone.com . there's been a promised 'locations database' that I still haven't done because I just can't figure it out.)
Thanks, and I apologize if this is the wrong place for this, and i'll go about deleting the post if that's the case. :)
(P.S: I changed the links to pink to match the banner uptop. Good? :D )
Source: http://community.livejournal.com/webdesign/1126476.html
-
making an online retail store
Date: 06/21/06
(WebDesign) Keywords: php, mysql, css, html, sql, java, shopping
I have a quick question about making an online store. I already know XHTML and CSS but as far as i know i cant make a shopping cart with just this. I think PHP and MySQL is what i need to learn but is that all i need or would i have to dig deeper into programing with something like OOP with Java or JPS?
Source: http://community.livejournal.com/webdesign/1128443.html
-
mysql_connect woes
Date: 06/23/06
(PHP Community) Keywords: php, mysql, asp, sql
I have a very simple script set up to verify weither or not I can connect to mySQL from a PHP script.
<?php $link = mysql_connect('localhost', 'root', 'XXXXXXXX'); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($link); ?>
I recieve the following error:
Could not connect: Can't connect to local MySQL server through socket '/var/mysql/tmp/mysql.sock' (13)
I tried replacing 'localhost' with 127.0.0.1 .
Now I have a completely different error message:
Could not connect: Lost connection to MySQL server during query
First of all I'd like to know why I can't just use 'localhost' and second, I'd like to get this damn thing to work! I'm really frustrated. I hope someone can help. I've searched all over the internet for a solution to my problem but am having no luck. mySQL is running fine, and the mysql.sock file is there where it should be. I can also log in from the command line. I am exasperated!
I am running Slackware 10, mySQL 5.0.21-log, and PHP 4.4.2.
Any ideas helping me out would be much appreciated. I need this to work!
Source: http://community.livejournal.com/php/463943.html
-
mysql_connect woes
Date: 06/23/06
(MySQL Communtiy) Keywords: php, mysql, asp, sql
I have a very simple script set up to verify weither or not I can connect to mySQL from a PHP script.
[bracket]?php $link = mysql_connect('localhost', 'root', 'XXXXXXXX'); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($link); ?[bracket]
I recieve the following error:
Could not connect: Can't connect to local MySQL server through socket '/var/mysql/tmp/mysql.sock' (13)
I tried replacing 'localhost' with 127.0.0.1 .
Now I have a completely different error message:
Could not connect: Lost connection to MySQL server during query
First of all I'd like to know why I can't just use 'localhost' and second, I'd like to get this damn thing to work! I'm really frustrated. I hope someone can help. I've searched all over the internet for a solution to my problem but am having no luck. mySQL is running fine, and the mysql.sock file is there where it should be. I can also log in from the command line. I am exasperated!
I am running Slackware 10, mySQL 5.0.21-log, and PHP 4.4.2.
Any ideas helping me out would be much appreciated. I need this to work!
Source: http://community.livejournal.com/mysql/98112.html
-
Help!
Date: 06/26/06
(Web Development) Keywords: php, mysql, css, html, sql, java
Thanks to everyone who responded to my last post here - there really is nothing better than hearing someone talk about something they're enthusiastic about :)
Now I have another question for you. A small company would like me to do some work for them. It's a new feature to their intranet, requiring experienced knowledge of HTML, CSS, JavaScript, PHP and MySQL - very much a skilled task. I need to come up with a proposal for it, which means I need some idea of what to charge.
I'm going to suggest a fixed amount, and I've worked out how many hours it's likely to take me, but I need some idea of an hourly rate. I don't want to devalue my services, but I don't want to overcharge them either. So my question: for a job requiring those skills, what sort of hourly rate would you charge for something like this?
Source: http://community.livejournal.com/webdev/330947.html
-
HELP: transferring database files into another computer
Date: 06/28/06
(MySQL Communtiy) Keywords: mysql, browser, database, sql
My friends (team-members) and I are working on a Final Year Project, and we have a problem with mySQL!
My team member has a complete database of our project, but i'd like to copy her database into my laptop and work from there too.
I've copied the folder 'fyp' (C:\Program Files\MySQL\MySQL Server 5.0\data\fyp) into the same directory in my laptop.
The following happened:
1. The database 'fyp' showed in mySQL query browser.
2. 'could not fetch columns' error appeared under this database in mySQL query browser.
3. Under "Catalogs" in mySQL administrator, the schemata 'fyp' is there, but it doesnt show its tables when i clicked on it.
DID I MISS OUT ANY FILES? DO I HAVE TO COPY ANY OTHER FILES OTHER THAN THE DATABASE 'FYP' FOLDER?
Kindly advise!
Thanks!
With love, the mySQL noob. =/
Source: http://community.livejournal.com/mysql/98792.html
-
MY SQL HELP
Date: 07/03/06
(WebDesign) Keywords: php, mysql, software, database, sql, security
Ok im trying to instal XMB forum software onto a server. I created the database etc etc config and everything seemed to be going ok and then, when its finially installing I keep getting this error
Checking PHP version.......................................................OK Checking Directory Structure...............................................OK Checking Required Files....................................................OK Checking Database Files....................................................OK Checking Database API......................................................OK Checking Database Connection Security......................................OK Checking Database Connection............................................... Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /homepages/11/d161790790/htdocs/Forum/install/index.php on line 997 ERROR
Database Connection XMB could not connect to the specified database. The database returned "error 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
I looked on the net and cant really make any sense of whats going on. Any ideas? Im 2 steps away from chucking my pc out the window.
Source: http://community.livejournal.com/webdesign/1133538.html
-
MySQL is used in most of the freelance projects
Date: 07/05/06
(MySQL Communtiy) Keywords: mysql, sql, postgresql
Statistical research based on analysis of more than 15000 freelance projects posted to getafreelancer.com (one of the biggest freelance sites along with scriptlance.com and others) shows that DBMS MySQL was used in 78.8% of completed projects, MS SQL Server – in 3.6%, PostgreSQL – in 0.62% http://freelancejob.com.ua/content/view/391/4/#en
Source: http://community.livejournal.com/mysql/99265.html
-
curdate() not workming?
Date: 07/06/06
(MySQL Communtiy) Keywords: mysql, database, sql
Maybe it's the code or something else, but... should this work? I am trying to export some data from the database.
-----------------------------------
$now1 = curdate(); $now2 = $now1[0]; $future = $now2 + 2419200;
$query = "SELECT * FROM ibf_cal_events WHERE event_unix_from BETWEEN $now2 AND $future ORDER BY event_unix_from";
$result = mysql_query( $query ); $start = 1; $end = mysql_num_rows( $result ); $items=0; $title_array = array (); $context_array = array ();
while( $start <= $end ) { $row = mysql_fetch_row( $result ); $id = $row[0];
-----------------------------------
This gave me an error message:
Fatal error: Unknown function: curdate() in /importcalevent.php on line 18
Line 18 is $now1 = curdate();
I tried $now1 = getdate(); and I got this error message:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /importcalevent.php on line 31
Line 31 is $end = mysql_num_rows( $result );
So I am not sure whch is correct and which is incorrect.
I am using MySQL 4.1
Thanks all.
Source: http://community.livejournal.com/mysql/99541.html
-
PHP errors within MySQL query
Date: 07/06/06
(PHP Community) Keywords: php, mysql, html, sql
Howdy all.
First of all, please see this post which I made to another community...
http://community.livejournal.com/mysql/99541.html
Yeah, I got confused with the code which I thought was MySQL problems but it turned out that it's actually PHP problems.
Now, does anyone have any ideas what's wrong with the codes?
Cheers.
Source: http://community.livejournal.com/php/467186.html
-
Suggested forum
Date: 07/07/06
(PHP Community) Keywords: php, mysql, sql
Looking to install a PHP/MySQL based forum/BBS on my site. Haven't done anything with a forum since my days with Perl/CGI. What do you guys suggest for a good inexpensive & open source forum package?
Source: http://community.livejournal.com/php/467580.html
-
Newbie trying to create a table
Date: 07/10/06
(MySQL Communtiy) Keywords: mysql, software, database, sql, web
I'm trying to create a database to record all the ENV variables for website visits. I haven't used mysql before, though I have a good deal of experience with MS Access and DB2, so I feel confident when working with SQL.
I created a database called sitetrack, connected to it with: use sitetrack;
and tried creating a table with the following statement: CREATE TABLE sitetrack( VISIT_DATE DATETIME, QUERY_STRING VARCHAR, SERVER_ADDR VARCHAR, HTTP_ACCEPT_LANGUAGE VARCHAR, SERVER_PROTOCOL VARCHAR, TZ VARCHAR, HTTP_CONNECTION VARCHAR, HTTP_REFERER VARCHAR, REMOTE_PORT VARCHAR, HTTP_USER_AGENT VARCHAR, HTTP_ACCEPT VARCHAR, GATEWAY_INTERFACE VARCHAR, HTTP_HOST VARCHAR, SERVER_SOFTWARE VARCHAR, SERVER_ADMIN VARCHAR, REMOTE_ADDR VARCHAR, SCRIPT_NAME VARCHAR, SERVER_NAME VARCHAR, HTTP_ACCEPT_ENCODING VARCHAR, DOCUMENT_ROOT VARCHAR, REQUEST_URI VARCHAR, HTTP_ACCEPT_CHARSET VARCHAR, REQUEST_METHOD VARCHAR, SCRIPT_FILENAME VARCHAR, HTTP_KEEP_ALIVE VARCHAR, PATH VARCHAR, SERVER_PORT VARCHAR);
When I do this I get the following error: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' SERVER_ADDR VARCHAR, HTTP_ACCEPT_LANGUAGE VARCHAR, SERVER_PROTOCOL VARCHAR, TZ ' at line 3
It looks to me that there's something wrong with the "SERVER_ADDR VARCHAR," line, but I can't see what. I don't see SERVER_ADDR listed in the reserved words on any document I've come across. Could someone offer any advice or direct me to documentation that would help me figure this out?
Source: http://community.livejournal.com/mysql/99714.html
-
strftime formatting issue
Date: 07/11/06
(PHP Community) Keywords: mysql, sql
When I use the following:
strftime('%C-%m-%d', $timestamp)
where $timestamp for example is 1144788825, this is how it formats the date: Tue Apr 11 13:53:45 PDT 2006-04-11
All I want is the 2006-04-11, because that matches the format of a date stored in MYSQL. Any idea why it is prepending it with the TUe Apr 11 and the full time etc. The manual on strftime is not helpful.
Edit:I do realize that I can strip off the 10 characters at the end to get the part I want using substr()
Thanks!
Source: http://community.livejournal.com/php/468503.html
-
J'ai une question.
Date: 07/20/06
(PHP Community) Keywords: mysql, sql
I have a question.
If I have a user enter their email at a login screen with their email and password, the following should work to match the password with the e-mail, correct?
$ema = $_POST['ema']; $pw = mysql_query("SELECT password FROM users WHERE email = '$ema'");
I mean, it's only logical. It's not just me, is it? I swear, I'm going crazy trying to figure out why this isn't working.
I'm getting results like Resource id#3 and Resource id#4 instead of the fields that should be called when I used those commands.
Any ideas?
Source: http://community.livejournal.com/php/472517.html
-
php/mySQL question
Date: 07/20/06
(MySQL Communtiy) Keywords: php, mysql, sql
Hey guys, mild programmer here. I've got a design question for you. I've made a mySQL/PHP site for the purpose of displaying the comics I make :) It works pretty well, but now I'm looking to refine my interface with it. One of my problems is with the primary key; currently I have it defined to auto_increment. The annoying thing about this is if I delete a comic and add a new one, the primary key will number it after the old one, not after the last one on the table, so that there will be a gap in the numbering. My code currently relies on the primary keys to be continuous... I know in an ideal world I'd program to handle gaps but anyway, this is just a personal site XD And ideally I would like the primary keys to be continuous even if I did have it programed to handle gaps, just because I'm a bit OC like that :P Anyway, I'm wondering how to make the tables easier to edit. Should/can I take out the auto_increment command and just assign a key 1+ the last key in the table via PHP, when I upload a new comic? Should I do something complicated like load the edited info to a temp new table, destroy and recreate the old table, and repopulate it with the new list each time I delete a row? Or is there a command that will reset the auto_increment feature to the last primary key (or to a number of my choosing)? Thanks!
EDIT: on looking around online more, it seems the common advice is to drop then readd the ID column, which will automatically renumber the rows. Seems a little sketchy, but if it works I guess it'd do. Thoughts?
Source: http://community.livejournal.com/mysql/100171.html
-
error in PHP & MySQL in a loop
Date: 07/21/06
(PHP Community) Keywords: php, mysql, html, database, sql
The following has been providing a bit of a problem for me over the past few days. I have an initial display page with the HTML form and text fields, however the number of text fields can be controlled by the user. As such they are all placed into an array within the $_POST array, to be retrieved later. I've tried doing this, and this alone works fine. The problem is when I try to loop through them to insert them into the database, for some reason while they will display through echo fine, only the first one will insert into the database, then throw an error. Below is a loose sample of the code.
The text fields in the HTML file are named as follows : $name[]
The code in the PHP file is as follows, excluding anything not necessary for the example :
$conn = db_connect(); // establishes a database connection if (!conn) { echo "database error"; exit; }
$i = 0;
while(isset($_POST['name'][$i])){
$name[] = $_POST['name'][$i];
$i++; }
$i = 0;
foreach($name as $name_current){
echo $name[$i];
echo $name_current;
$query = mysql_query("insert into names values ('$other_variable','$other_variable2', '$name_current', '', '', '')");
$i++;
if(!$query){ echo "Database Error"; exit; }else{ echo "Name added successfully!"; } }
if anyone can spot something I'm overlooking please let me know, I'm still at a loss for why it will only insert into the query on the first pass through the loop, however if I'm just echoing the values it will work fine.
Thanks, Exeyel
Source: http://community.livejournal.com/php/472928.html
|