Jump to content
poterasal

Problema baza de date

Recommended Posts

Posted

Am o baza de date si incerc sa o urc in phpmyadmin.

Primesc o eroare

#1064 - 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 '(14) NOT NULL,
cron_status enum('done','running') NOT NULL default 'done',
' at line 8

Iar in baza de date se afla codul care imi da eroare:

CREATE TABLE phpjob_cronjobs (
cron_type enum('jobmail','resumemail','expire') NOT NULL default 'jobmail',
cron_date datetime NOT NULL default '0000-00-00 00:00:00',
cron_start timestamp(14) NOT NULL,
cron_status enum('done','running') NOT NULL default 'done',
cron_priority tinyint(1) NOT NULL default '0'
);

Stiti ce ar trebui sa fac in cazul asta?

Posted

Am sters , primesc alta eroare:

Error
SQL query:

INSERT INTO `phpjob_crossnetwork`
VALUES (

'', 'Default Template RSS', '', 'latest_jobs', 'rss', 'english', 10, '<?xml version="1.0" encoding="iso-8859-1"?>\r\n<rss version="2.0">\r\n<channel>\r\n
<title>Latest Jobs Posted</title>\r\n <link>%%HOME_LINK%%</link>\r\n <description>Latest Jobs
Posted</description>\r\n <pubDate>%%today_date%%</pubDate>\r\n <generator>rss20 by
%%HOME_LINK%%</generator>\r\n <webMaster>%%site_mail%%</webMaster>\r\n', '\r\n<item>\r\n
<title>%%job_jobtitle%%</title>\r\n <link>%%job_link%%</link>\r\n
<description>%%job_description%%</description>\r\n <pubDate>%%job_jobdate%%</pubDate>\r\n</item>\r\n', '\r\n</channel>\r\n</rss>', '\r\n<item>\r\n <title>No Job Found</title>\r\n
<link>%%HOME_LINK%%</link>\r\n <description>Visit %%HOME_LINK%% to see all the jobs
available</description>\r\n <pubDate>%%today_date%%</pubDate>\r\n</item>\r\n', NOW( ) , 'yes', 0, '', ''
);

MySQL said: Documentation

#1062 - Duplicate entry '0' for key 'PRIMARY'

Iar codul sursa din baza de date:

CREATE TABLE `phpjob_crossnetwork` (
`cross_id` int(5) NOT NULL auto_increment,
`cross_name` varchar(80) NOT NULL default '',
`cross_specialids` text NOT NULL,
`cross_type` varchar(20) NOT NULL default '',
`cross_output` enum('js','iframe','rss') NOT NULL default 'js',
`cross_language` varchar(40) NOT NULL default '',
`cross_display` int(5) NOT NULL default '0',
`cross_header` text NOT NULL,
`cross_main` text NOT NULL,
`cross_footer` text NOT NULL,
`cross_noresult` text NOT NULL,
`cross_date` date NOT NULL default '0000-00-00',
`cross_active` enum('yes','no') NOT NULL default 'yes',
`cross_visit` bigint(11) NOT NULL default '0',
`cross_extratype` varchar(30) NOT NULL default '',
`cross_extraids` text NOT NULL,
PRIMARY KEY (`cross_id`)
);

  • Active Members
Posted

Cred ca ar trebui sa ii precizezi pe ce coloane sa introduca datele alea dar sa nu includa keya primara gen:

INSERT INTO phpjob_crossnetwork (`cross_name`,`cross_specialids`,`cross_type`....) VALUES('Default Template RSS','',.....)

Compltezi tu acolo..

Posted (edited)

La tine problema sunt inregistrarile nu tabelele.


mysql> create table `phpjob_cronjobs` (
-> `cron_type` enum('jobmail','resumemail','expire') NOT NULL DEFAULT 'jobmail',
-> `cron_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
-> `cron_start` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-> `cron_status` enum('done','running') NOT NULL DEFAULT 'done',
-> `cron_priority` tinyint(4) NOT NULL DEFAULT '0');
Query OK, 0 rows affected (0.14 sec)

mysql> describe phpjob_cronjobs;
+---------------+---------------------------------------+------+-----+---------------------+-----------------------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+---------------------------------------+------+-----+---------------------+-----------------------------+
| cron_type | enum('jobmail','resumemail','expire') | NO | | jobmail | |
| cron_date | datetime | NO | | 0000-00-00 00:00:00 | |
| cron_start | timestamp | NO | | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
| cron_status | enum('done','running') | NO | | done | |
| cron_priority | tinyint(4) | NO | | 0 | |
+---------------+---------------------------------------+------+-----+---------------------+-----------------------------+
5 rows in set (0.00 sec)

mysql> CREATE TABLE `phpjob_crossnetwork` (
-> `cross_id` int(5) NOT NULL auto_increment,
-> `cross_name` varchar(80) NOT NULL default '',
-> `cross_specialids` text NOT NULL,
-> `cross_type` varchar(20) NOT NULL default '',
-> `cross_output` enum('js','iframe','rss') NOT NULL default 'js',
-> `cross_language` varchar(40) NOT NULL default '',
-> `cross_display` int(5) NOT NULL default '0',
-> `cross_header` text NOT NULL,
-> `cross_main` text NOT NULL,
-> `cross_footer` text NOT NULL,
-> `cross_noresult` text NOT NULL,
-> `cross_date` date NOT NULL default '0000-00-00',
-> `cross_active` enum('yes','no') NOT NULL default 'yes',
-> `cross_visit` bigint(11) NOT NULL default '0',
-> `cross_extratype` varchar(30) NOT NULL default '',
-> `cross_extraids` text NOT NULL,
-> PRIMARY KEY (`cross_id`)
-> );
Query OK, 0 rows affected (0.19 sec)

mysql> describe phpjob_crossnetwork;
+------------------+---------------------------+------+-----+------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------------+---------------------------+------+-----+------------+----------------+
| cross_id | int(5) | NO | PRI | NULL | auto_increment |
| cross_name | varchar(80) | NO | | | |
| cross_specialids | text | NO | | NULL | |
| cross_type | varchar(20) | NO | | | |
| cross_output | enum('js','iframe','rss') | NO | | js | |
| cross_language | varchar(40) | NO | | | |
| cross_display | int(5) | NO | | 0 | |
| cross_header | text | NO | | NULL | |
| cross_main | text | NO | | NULL | |
| cross_footer | text | NO | | NULL | |
| cross_noresult | text | NO | | NULL | |
| cross_date | date | NO | | 0000-00-00 | |
| cross_active | enum('yes','no') | NO | | yes | |
| cross_visit | bigint(11) | NO | | 0 | |
| cross_extratype | varchar(30) | NO | | | |
| cross_extraids | text | NO | | NULL | |
+------------------+---------------------------+------+-----+------------+----------------+

Solutia:

- Editezi dump-ul (fisierul pe care vrei sa-l importi) si adaugi al fiecare insert 'ignore'.

Exemplu

Din asta al tau:


INSERT INTO `phpjob_crossnetwork`

In asta:


INSERT IGNORE INTO `phpjob_crossnetwork`

Si aici avem un manual dragalas: https://dev.mysql.com/doc/refman/5.5/en/insert.html

Edited by aelius
  • Active Members
Posted

Insertu ala modifa-l cum ti-am spus mai sus, specifica coloanele dar sa nu includa keia primara.

Uite cum ar trebui sa arate



INSERT INTO `phpjob_crossnetwork` (`cross_name`,`cross_specialids`,`cross_type`,`cross_output`,`cross_language`,`cross_display`,`cross_header`,`cross_main`,`cross_footer`,`cross_noresult`,`cross_date`,`cross_active`,`cross_visit`,`cross_extratype`,`cross_extraids`)
VALUES ( 'Default Template RSS', '', 'latest_jobs', 'rss', 'english', 10, '<?xml version="1.0" encoding="iso-8859-1"?>\r\n<rss version="2.0">\r\n<channel>\r\n
<title>Latest Jobs Posted</title>\r\n <link>%%HOME_LINK%%</link>\r\n <description>Latest Jobs
Posted</description>\r\n <pubDate>%%today_date%%</pubDate>\r\n <generator>rss20 by
%%HOME_LINK%%</generator>\r\n <webMaster>%%site_mail%%</webMaster>\r\n', '\r\n<item>\r\n
<title>%%job_jobtitle%%</title>\r\n <link>%%job_link%%</link>\r\n
<description>%%job_description%%</description>\r\n <pubDate>%%job_jobdate%%</pubDate>\r\n</item>\r\n', '\r\n</channel>\r\n</rss>', '\r\n<item>\r\n <title>No Job Found</title>\r\n
<link>%%HOME_LINK%%</link>\r\n <description>Visit %%HOME_LINK%% to see all the jobs
available</description>\r\n <pubDate>%%today_date%%</pubDate>\r\n</item>\r\n', NOW( ) , 'yes', 0, '', ''
);

Posted

Am rezolvat problema cu baza de date in schimb ma lovesc de alta problema.

Am facut conexiunea catre baza de date + setarile in config dar imi apar urmatoarele erori :

Warning: include(DIR_SERVER_ROOTconf/db_settings.php): failed to open stream: No such file or directory in /home/livestri/public_html/main_config.php on line 24

iar in main.config.php se afla urmatorul cod:

include(DIR_CONFIG . 'db_settings.php');

Ce este gresit in asta?

Posted (edited)
Am rezolvat problema cu baza de date in schimb ma lovesc de alta problema.

Am facut conexiunea catre baza de date + setarile in config dar imi apar urmatoarele erori :

Warning: include(DIR_SERVER_ROOTconf/db_settings.php): failed to open stream: No such file or directory in /home/livestri/public_html/main_config.php on line 24

iar in main.config.php se afla urmatorul cod:

include(DIR_CONFIG . 'db_settings.php');

Ce este gresit in asta?

Sterge linia si pune asa:


include(dirname(__FILE__) . '/conf/db_settings.php');

Sau asa:


include($_SERVER['DOCUMENT_ROOT']."/conf/db_settings.php");

Dupa informatiile tale, fisierul 'db_settings' se afla in directorul 'conf/'

Edited by aelius
Posted

Pai sunt doua optiuni acolo:

1. Site-ul ce vrei sa-l pui e praf.

2. Nu stii sa-l configurezi.

Eu vreau sa te ajut, dar mi-e imposibil sa iti dau mai multe hint-uri pentru ca nu pot decat sa-mi imaginez ce e acolo. Daca doresti ajutor direct sa-l faci, te sfatuiesc sa contactezi un om de pe aici care se ocupa cu programarea php.

Iti recomand pe @eusimplu ; Eu am altele pe cap.

Posted (edited)

Ne poti da numele scriptului folosit ca sa te putem ajuta sugerandu-ti alte modalitati?

Deoarece, analizand dupa ce erori ai intalnit, acel script nu a fost si nu este functional.

Edited by eusimplu

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...